On page 385, you show an example of how to use prev and parent methods to traverse the DOM. In the middle of page, you show a snippet:
alert($('#DemoTable td:contains("3")').prev()[0].innerHTML);
How exactly is this used? I cannot get his to work...a test page I created loads but nothing happens. I do in fact have a table with the ID of DemoTable and I do have a cell with "3" (1-6 sequential cells).
Code:
<table align="center" border="1" width="500" id="DemoTable">
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>5</td>
<td>6</td>
</tr>
</table>
<script type="text/javascript">
alert($('#DemoTable td:contains("3")').prev()[0].innerHTML);
</script>
Thanks!