<table>
<tr class="csstablelisttd">
<td>
</td>
<td>
15
</td>
</tr>
<tr class="csstablelisttd">
<td>
</td>
<td>
30
</td>
</tr>
<tr class="csstablelisttd">
<td>
</td>
<td>
45
</td>
</tr>
$(".csstablelisttd").live('mousedown', function(e) {
lastRow = $(this).closest("tr")[0].rowIndex;
}
How can I get the column index on mouse down of class in jQuery?
To get the index of the column, you may use the index function :
DEMONSTRATION
Note that you must have the event detected on the
td, not thetr.