I am trying to navigate a table row that has been clicked, to extract data from other parts of the row.
this is the HTML snippet of the row that was clicked on:
<tr><td class=" sorting_1">Foobar</td>
<td>Hello</td><td><a href="/some/path/abc.html">42</a></td>
<td>0</td>
<td><img src="/images/img.gif"></td>
<td>7:44 AM</td>
<td><ul><li><a href="/path2/read/3">Read it</a></li>
<li><a class="booboo" href="#">Just do it</a></li>
</ul></td>
The cell element that was clicked on has class “booboo”.
I want to be able to select the following data:
- the id used in the url of the previous li a sibling (it is 3 in the example given above)
- the name in the first column (it is ‘Foobar’ in the example given)
- the url of the anchor elem in the 2nd cell (should be /some/path/abc.html in this example)
Can anyone point out the functions required to navigate a table row, preferably with a snippet showing how to select the values in the sample snippet shown above?
No hill for a climber…
Demo on jsFiddle