javascript - How to get a jQuery item in a collection of selectors -
i access selector in array:
<ul> <li class="elem">a</li> <li class="elem">b</li> <li class="elem">c</li> </ul> var $elems = $('li.elem'); console.log($elems[1].text()); /* jquery method call */
i know there get()
method, seems implementation se []
operator. best way access item on jquery array?
should $($elems[1]).text()
?
use method text .eq
$('li.elem').eq(1).text();
Comments
Post a Comment