jQuery: getting the id of a <td> within the whole table

jaydeedogg

New Member
I'm trying to retrieve the id of a certain table cell within the whole table.Example\[code\]<table> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>4</td> <td class="current">5</td> <td>6</td> </tr></table>\[/code\]I'm trying to get the index of \[code\]td.current\[/code\] but not in relation the \[code\]<tr>\[/code\] but of \[code\]<table>\[/code\]So instead of simply doing \[code\]$('td.current').index() \[/code\]which will output 1, I need it to output 4 (5th td in the whole table).Reading the index() doc, I've tried multiple stuff but it always returned -1.I could do this with a loop, but am trying to do it only with selectors.Is this possible?
 
Back
Top