I am trying to find, using JQuery, the row and column number of a table cell. However, my tables are nested:
<table>
<tr>
<td>
<table><tr><TD></TD></tr></table>
<td>
<table>...</table>
</tr>
<tr>
...
</table>
The td object that JQuery should act on is the on on the inner table. I have noted it with capitals in the above code.
I’ve seen some examples for single tables – is there a way to do this for nested ones as well?
EDIT:
That is to say, I am trying to find the row and column number of the OUTSIDE table, but the object being acted on is an INSIDE td element.
This will get you the parent
td:Note: using just
parent()will not work, since that only looks at the immediate parent. Usingclosest()on its own wouldn’t work either, since it’ll return the currenttd, becauseclosest()looks for the closest element matching the passed selector, including the current element.