jQuery filter() 方法

filter() 方法允许您规定一个标准。不匹配这个标准的元素会被从集合中删除,匹配的元素会被返回。

下面的例子返回带有类名 "intro" 的所有 <p> 元素:

$(document).ready(function(){
  $("p").filter(".intro");
});

jQuery not() 方法

not() 方法返回不匹配标准的所有元素。

提示:not() 方法与 filter() 相反。

下面的例子返回不带有类名 "intro" 的所有 <p> 元素:

实例

$(document).ready(function(){
  $("p").not(".intro");
});

相关文章:

  • 2021-06-17
  • 2022-12-23
  • 2021-05-26
  • 2021-07-27
  • 2022-12-23
猜你喜欢
  • 2021-09-09
  • 2021-11-07
  • 2022-02-03
  • 2022-12-23
  • 2022-03-01
相关资源
相似解决方案