jQuery filter() 方法

jQuery 教程 · 2019-03-28 06:18:45

实例

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

$("p").filter(".intro")

定义和用法

filter() 方法返回符合一定条件的元素。

该方法让您规定一个条件。不符合条件的元素将从选择中移除,符合条件的元素将被返回。

该方法通常用于缩小在被选元素组合中搜索元素的范围。

提示:filter() 方法是与 not() 方法相对的。

语法

$(selector).filter(criteria,function(index))

参数 描述
criteria 可选。规定要从被选元素组合中返回的选择器表达式、jQuery 对象、一个或多个元素。

提示:如需规定多个条件,请使用逗号分隔。
function(index) 可选。为集合中的每个元素规定要运行的函数。如果返回 true,则保留元素,否则元素将被移除。
  • index - 集合中元素的 index 位置。
注意: this 是当前的 DOM 元素。

点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html

查看所有标签

Getting Started with C++ Audio Programming for Game Development

Getting Started with C++ Audio Programming for Game Development

David Gouveia

Written specifically to help C++ developers add audio to their games from scratch, this book gives a clear introduction to the concepts and practical application of audio programming using the FMOD li......一起来看看 《Getting Started with C++ Audio Programming for Game Development》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

在线进制转换器
在线进制转换器

各进制数互转换器

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换