views:

28

answers:

1

How do you translate the following into jQuery?

document.getElementsByClassName('x')[5]

$('.x')[5] does not seem to work. i could go with a

$('.x').each(){function(i){ if(i==5) return $(this) })

but there must be an easier inline way.

+3  A: 

You could use the :eq() selector:

$('.x:eq(5)');
Darin Dimitrov
cool, thanks for the prompt reply dude!
fabjoa