I have the following HTML
<ul id="listing">
<li>...</li>
<开发者_StackOverflow中文版;li>...</li>
<li>...</li>
</ul>
How can I access the 2nd LI
inner text?
Can I do
$("#listing li").[1].text()
If not, what is the sytax?
$("#listing li:eq(1)").text();
More about the Index Selector at http://docs.jquery.com/Selectors/eq#index
close
$("#listing li").eq(1).text()
http://docs.jquery.com/Traversing/eq
have a look at the eq selector in jquery
精彩评论