【发布时间】:2013-05-02 19:29:18
【问题描述】:
我试图弄清楚,在遍历某些列表项时,如何在嵌套的 foreach 循环中定位每个“$(this)”等价物。这是我的问题的一个例子:
$('li').each(function(){
// I believe $(this) would target each li item...
$(this).children("li").each(function(){
// ... but how can I target each of these li items? Doesn't $(this) target the original loop?
});
});
【问题讨论】:
-
你要定位li儿童?
-
您想遍历
<li>s 中的<li>s 吗?
标签: javascript jquery html