The ".index()" function takes some getting used to, but it does work once it's fully understood what is going on with it... the selector should be the collection of DOM objects you are looking for and the value in the index() should be one of those selected-from-the-selector DOM objects
Example: http://jsbin.com/egeqe/edit some other tips in there for you too, like using the ".hover" event instead of all that hardwired onmouseover/out stuff :-) On Dec 11, 8:54 am, Bunn <cbun...@gmail.com> wrote: > I am setting the rows of my grid (which outputs an HTML table) using > jquery > > $('#gvReturnedChecks tr:odd').addClass('odd'); > $('#gvReturnedChecks tr:even').addClass('even'); > > I am selecting a row in the grid to perform an update. I perform the > update using an ajax call. I need to know the index of the node being > updating. > > My plan is to use the expression - if (size % 2 == 0) to determine if > this is an even or odd row in order to know what color to set the > background to, by setting the following class: > > .addClass('even') or .addClass('odd') > > I have the object of the current table row, by transversing from the > where the 'Select' link was clicked within the row. I have tried > using the jquery .index() method and rowIndex to no avail - Neither > are returning the index of the row in respect to it's siblings within > the table > > Any help is appreciated - I have googled for hours on this and have > been unable to find a solution. Thanks! > > NOTE - Below is the structure of the table row > > <tr > onmouseover="this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='#999999'" > onmouseout="this.style.backgroundColor=this.originalstyle;"> > <td align="center"> > <a > id="gvReturnedChecks_ctl02_lnkDelete" class="confirmDelete" > href="javascript:__doPostBack('gvReturnedChecks$ctl02$lnkDelete','')" > style="color:#0066CC;">Delete</a> > </td><td align="center"> > <a > id="gvReturnedChecks_ctl02_lnkSelect" class="select" > href="javascript:__doPostBack('gvReturnedChecks$ctl02$lnkSelect','')" > style="display:inline-block;color:#0066CC;width:50px;">Select</a> > </td><td> > <span > id="gvReturnedChecks_ctl02_lblReturnedID" > class="returnedCheckID">7001</span> > </td><td> > <span > id="gvReturnedChecks_ctl02_lblPlayerName" class="playerName">Jeffrey > Clark</span> > </td><td> > <span > id="gvReturnedChecks_ctl02_lblCheckNumber" > class="checkNumber">7026844</span> > </td><td> > <span > id="gvReturnedChecks_ctl02_lblDateCheckIssued" > class="dateCheckIssued">3/2/2009</span> > </td><td> > <span > id="gvReturnedChecks_ctl02_lblCheckAmount" class="checkAmount">3.00</ > span> > </td><td> > <span > id="gvReturnedChecks_ctl02_lblDateCheckReturned" > class="dateCheckReturned">3/23/2009</span> > </td><td> > <span > id="gvReturnedChecks_ctl02_lblClaimNumber" > class="claimNumber">09030200135</span> > </td><td> > <span > id="gvReturnedChecks_ctl02_lblEnteredBy" class="enteredBy">Bob</span> > </td><td> > <span > id="gvReturnedChecks_ctl02_lblDateEntered" > class="dateEntered">11/1/2009</span> > </td> > </tr>