这应该是一件简单的事情,但是我在网上没有找到很多内容:
我有一个无序列表
我有一个无序列表
- ,下面有几个列表项
- ,我想对每个列表项进行操作。如何使用jQuery来实现?
谢谢。
类似于以下内容:
$('#myulid').children('li').each(function(i, n) { alert($(this).html()); });
$("ul#id_of_desired_ul > li").each(function() {
//do stuff
// $(this) references each li
});
$('ul#id > li').each(...)
。 - Randal Schwartz
each()
- http://docs.jquery.com/Core/each,而不是实用函数`each()` :) - Russ Cam$('ul#id > li').each(...)
。 - Randal Schwartz