jquery复杂节点获取

jquery.find方法

1

$("div").find(".1").css({"color":"red","border":"2px solid red"});

2

$( "li.item-ii" ).find( "li" ).css( "background-color", "red" );

3

var item1 = $( "li.item-1" )[ 0 ];
$( "li.item-ii" ).find( item1 ).css( "background-color", "red" );

4

var spans = $( "span" );
$( "p" ).find( spans ).css( "color", "red" );

5

$( "p" )
  .html( newText )
  .find( "span" )
    .hover(function() {
      $( this ).addClass( "hilite" );
    }, function() {
      $( this ).removeClass( "hilite" );
    })
  .end()
  .find( ":contains('t')" )
    .css({
      "font-style": "italic",
      "font-weight": "bolder"
    });

参考地址:https://api.jquery.com/find/

--------------------------------------------

jquery  parents()方法

待补充………………

 

-------------------------------

标题:jQuery-样式(jQuery选择器)

参考:https://www.csdn.net/gather_2a/OtTaIgxsNjUzLWJsb2cO0O0O.html

 

posted on 2019-11-05 18:46  荆棘人  阅读(235)  评论(0编辑  收藏  举报

导航