dom - Why does $("ul:first").find("li") work but $("ul")[0].find("li") doesn't work in jQuery? -
does mean $("ul")[0]
not jquery object because works when use $($("ul")[0]).find("li")
, though looks little ugly.
does have ideas why $("ul")[0]
can't used find
directly?
that's right; jquery object acts extension of array of dom elements. if access of them index, raw dom object, not jquery object. if want access jquery object 1 of elements object represents, use eq
:
$('ul').eq(0).find('li')
Comments
Post a Comment