I have a nested table 3x3
<table>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td id='myCell'></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
So, i need to get cells closed to my '#myCell' - on the left, on the right, top, bottom.
var myCell = $('#myCell')[0];
var leftCell = myCell.previousSibling;
var rightCell = myCell.nextSibling;
var topCell = $(myCell).parent()[0].previousSibling().children()[myCell.cellIndex];
var bottomCell = $(myCell).parent()[0].nextSibling().children()[myCell.cellIndex];
It seems that is ok. Now i need get the same cells with specefic table layout.
<table>
<tr>
<td rowspan=3></td>
<td></td>
<td></td>
</tr>
<tr>
<td id='myCell'></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
This layout implies that i could get top, right, bottom cells.