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

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -