views:

18

answers:

1

Anyone know the proper syntax to write this statement?

$('.nav ul li')[0].children("a")

For some reason this is not working. The return is that its not a function. :(

+1  A: 

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.

Yi Jiang