tags:

views:

1536

answers:

2

jQuery can return last or first child,it works ok.

But I need to get second child.

This construction (get child by index) doesn't work,when get its text:

child.parent().parent().children().get(1).text()

So, how can i find non-last and non-first child (e.g. second)?

+4  A: 

Try this: (.eq()):

selection.eq(1).text()
DrJokepu
+3  A: 

try eq() instead of get():

child.parent().parent().children().eq(1).text()

you can also do it by selector:

$("div:eq(1)")
Lobstrosity