JQuery---高级类选择器

1.ContentFilters

  1.1 语法:$('div:contains(edu)').css('backgroundColor','yellow');

  只看div 本身是否包含内容

  1.2 语法: $('div:empty').css('backgroundColor','yellow');

  1.3 语法:$('div:has(span)').css('backgroundColor','yellow');

  1.4语法:$('div:parent').css('backgroundColor','yellow');

2.Visibility Filters

  2.1 语法:$('div:hidden').css('display','block);

  2.2语法 :$('div:visible').css('display','none');

3.Attribute Filters

   语法:$('li[class]')

   语法:$('a[xxx="self"]')

   语法:$('a[rel!="nofollow"]')

   语法:$('[class^="my"]')

   语法:$('a[href*="zip"]')

   语法:$('a[rel][href][title="blog"]')  可以满足中括号中所有的

   正则表达式:^表示开始,$表示结束 ,*表示任意多个

4.Child Filters

  $('div:only-child').css('backgroundColor','yellow');

  这个是唯一子元素 的时候才能被选中。

5.Forms 

  $(':input')

  $(':text')

     $(':password')

  $(':radio')

  $(':checkbox')

  $(':submit')

  $(':image')

  $(':reset')

  $(':button')

  $(':file')

6.Form Filters

  $('input:enabled)

  $(':disabled')

  $(':checked')

  $(':selected')

  

原文地址:https://www.cnblogs.com/kangxinxin/p/8307008.html