tags:

views:

159

answers:

2

Does eq(index) in JQuery can accept index more than 9?

And if yes, there is any work around? or alternatives?

I am asking because i wrote some code using JQuery for scrapping.

And when testing on this page:

http://www.zappos.com/n/p/p/7498055/c/181710.html

with this JQuery selector "HTML BODY CENTER TABLE TBODY TR TD TABLE TBODY TR TD TABLE TBODY TR TD TABLE TBODY TR TD TABLE TBODY TR TD TABLE TBODY TR TD FONT:eq(11)"

it fails, and i found it just work if the index less than 10, and any number greater than 9 it get the wrong elements.

+2  A: 

Yes, it accepts any index as long as it is in-range.

If you're asking for an alternative to limit it to an index of 9, then you could limit it by using some code like this:

if (index <= 9 && index >= 0) $('p').eq(index).foo();
James Skidmore
A: 

yes you can

see example of use of index with eq() to set focus on input fields

http://jqueryminute.com/blog/set-focus-to-the-next-input-field-with-jquery/

Haim Evgi