输出每个 <li> 元素的文本:
$("button").click(function(){ $("li").each(function(){ alert($(this).text()) }); });
each() 方法为每个匹配元素规定要运行的函数。
提示:返回 false 可用于及早停止循环。
0