jQuery each () method
Examples
Output text of each <li> element:
$("button").click(function(){
$("li").each(function(){
alert($(this).text())
});
});
$("li").each(function(){
alert($(this).text())
});
});
try it"
Definition and Usage
each () method as a function of each matching element specified to run.
NOTE: Returns false can be used as soon as possible to stop the cycle.
grammar
$(selector).each(function(index,element))
参数 | 描述 |
---|---|
function(index,element) | 必需。为每个匹配元素规定运行的函数。
|