jQuery 杂项 each() 方法

jQuery 教程 · 2019-03-28 18:18:10

实例

输出每个 <li> 元素的文本:

$("button").click(function(){ $("li").each(function(){ alert($(this).text()) }); });

定义和用法

each() 方法为每个匹配元素规定要运行的函数。

提示:返回 false 可用于及早停止循环。

语法

$(selector).each(function(index,element))

参数 描述
function(index,element) 必需。为每个匹配元素规定运行的函数。
  • index - 选择器的 index 位置。
  • element - 当前的元素(也可使用 "this" 选择器)。

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

查看所有标签

Real-Time Collision Detection

Real-Time Collision Detection

Christer Ericson / CRC Press / 2004-12-22 / USD 98.95

Written by an expert in the game industry, Christer Ericson's new book is a comprehensive guide to the components of efficient real-time collision detection systems. The book provides the tools and kn......一起来看看 《Real-Time Collision Detection》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试