getting diagonal and vertical adjacent cells of a table in jquery
<p>I have a 4X4 table. I want to get to get adjacent that are vertical, and diagonal on the top on bottom. I don't have a problem getting them when the cell i click on is around the edges because i can use something like this.</p>

<pre><code>above = $(that).parent().prev().children().first()
below = $(that).parent().prev().children().last()
diagonalLeft = $(that).parent().children().last().prev()
diagonalRight = $(that).parent().children().first().next()
</code></pre>

<p>But when i have one of these cases, when I can't use the first or last one, I don't know what to do. I can't figure out the logic for it.</p>
