我在each
循環處理一系列元素作爲如何處理jQuery每個循環中的第n個元素?
function test(){
$('#first li').each(function(n){$(this).//here is the jQuery effects for nth li
\\ here I want to process nth li of id="second" too
});
我怎樣才能simoltanously處理另一個ID的第n個元素呢?
例如,我想爲DIV first
和second
的第一個li
s製作jQuery效果;然後是兩個DIV的第二個li
。
<div id="first">
<ul>
<li>something</li>
<li>something</li>
<li>something</li>
</ul>
</div>
<div id="second">
<ul>
<li>to be effect with 1st li of FIRST</li>
<li>to be effect with 2nd li of FIRST</li>
<li>to be effect with 3rd li of FIRST</li>
</ul>
</div>
我相信他知道已經,你可以在他的問題看他用'index'參數,他稱這是'N'。 – gdoron