Calling children of specified index?
Anyone know the proper syntax to write this statement?
$('.nav ul li')[0].children("a")
For some reason this is not working. The return i开发者_如何学Pythons that its not a function. :(
You can try this for getting the first element from the results.
$('.nav ul li').first().children("a")
Or if you need a specific index
$('.nav ul li').eq(0).children("a")
You can also use the selectors :eq(n)
and :first
if you want.
精彩评论