jQuery选择器的介绍

 时间:2026-02-15 13:02:31

1、 a 基本选择器 selected/s1.html  #id        id选择器  element    元素选择器  .class     类选择  *          通配符匹配  selector1,selector2,selectorN 选择器合并查找   

jQuery选择器的介绍

2、function f1(){  //id选择器  $('#d0').css('font-size','50px'); } function f2(){  //元素选择器  $('p').css('font-size','50px') }

jQuery选择器的介绍

3、 function f3(){  //类选择器  $('.c1').css({'font-size':'50px'}); } function f4(){  //组合选择  $('#d2,p').css({'font-size':'50px','color':'red'}); } function f5(){  //通配符*  $('*').css('font-size','50px').css('color','red'); } function f6(){  //使用元素.class  $('p.c2').css({'color':'red'});  //元素  空格   元素 } function f7(){  $('div p').css('color','red'); }

jQuery选择器的介绍

1、b 层级选择器 selected/s2.html         ancestor descendant 查找当前节点符合要求的所有后代节点          parent > child      只查找当前节点符合要求的子节点        prev + next         查找当前节点的符合要求的下一个兄弟节点         prev ~ siblings     查找当前节点符合要求的下面所有兄弟节点   

jQuery选择器的介绍

2、function f1(){  //$('#d0 div').css('color','red');  //$('#d0').css('color','red');  $('#d0 p,div').css('font-size','50px'); } function f2(){  $('#d0>div').css('font-size','50px');  $('#d0>div').css('color','red'); }

jQuery选择器的介绍

3、 function f3(){  //$('#d2+#d4').css('color','red');  $('#d2+*').css('color','red'); } function f4(){  //$('#d2~*').css('color','red')  $('#d2~div,#d2~.s1').css('color','red') }

jQuery选择器的介绍

  • jQuery选择器总结
  • jQuery九大选择器
  • jQuery 选择器:*号选择全部
  • jQuery :first 选择器的应用
  • jQuery层次选择器实例详解
  • 热门搜索
    暑假旅游攻略 桃花岛旅游攻略 红烧大黄鱼 窦性心动过速怎么办 校园新闻稿怎么写 香蕉减肥法 大航海时代4威力加强版攻略 左旋肉碱可以减肥吗 苹果6id怎么注册 inside攻略