Try instead .eq()
.
$('#someTable tbody .graphedRow').eq(pointIndex+1).css('background-color', '#FEFF9F');
Although it should be noted that eq()
starts with 0 for the index.
There was a small check in Firebug.
:nth-child
in this case a little faster than .eq()
. (Hundreds of ms faster)
It also :nth-child
worked fine, but it bases its index on all child elements #someTable tbody
. It just returns those that have a class .graphedRow
.
, JSFiddle, 6 <tr>
<tbody>
, .graphedRow
( 1-, 4- 6- <tr>
). :nth-child(1)
, :nth-child(4)
, :nth-child(6)
, .
:nth-child
- #someTable tbody
(Other <tr>
, )
- .eq()
, .graphedRow
#someTable tbody