I have a html page. It contains table. I want to find out a particular cell's index which is in the same position. ie, Here is my table, <pre lang="HTML"> <table border="1"> <tr> <td rowspan="2">Label 1</td> <td rowspan="2">Label 2</td> <td colspan="2">Label 3</td> <td>Something else</td> </tr> <tr> <td>Item 1</td> <td>Item 2</td> <td>Item 3</td> </tr> <tr> <td> 1</td> <td> 2</td> <td> 3</td> <td> 4</td> <td> 5</td> </tr> </table> </pre> Here I want to find the index of the next row's td in the same position of item2.(ie, index of 4) . How it is possible with jQuery? (if click item 2 , i want to alert index of<td>4</td><pre lang="HTML"></pre>)
$("table tr td").click(function () { var currentIndex = $(this).index(); $(this).closest('tr').next().find("td:eq(" + currentIndex + ")") });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)