I want to return the index of a given tr when I click on an element inside of a td.
The html
<table class="tablesorter-js">
<thead>
<tr>
<th class="txt-align-left>Builder</th>
<th class=" txt-align-left " jobs">Current jobs</th>
<tbody>
<tr>
<td>some text <a class="link" href="#">A link</a>
</td>
<td>tome more text</td>
</tr>
<tr>
<td>some text <a class="link" href="#">A link</a>
</td>
<td>tome more text</td>
</tr>
</tbody>
</table>
the javascript
$('.link').click(function(e {
e.preventDefault();
console.log(oTable.fnGetPosition(this))
});
I know I can invoke the index of the current tr with this
var oTable = $('.tablesorter-js').dataTable();
$('.tablesorter-js tbody tr').click( function () {
var pos = oTable.fnGetPosition(this)
// I want the position of the tr element when I click on .link
return pos;
});
How do I get that index of the current tr element when I click on .link?