I have a table like this, and I need to get a row index value when clicking on a particular cell in a row. I don't need to get any values when clicking on rest of the cells.
<table>
<tr>
<td>1</td><td>1</td><td>1</td>
</tr>
<tr>
<td>2</td><td>2</td><td>2</td>
</tr>
<td>3</td><td>3</td><td>3</td>
</tr>
</table>
Here is my jQuery code goes. I am getting row index value perfectly
$(function(){
$("table tr").click(function(){
console.log($(this).index());
});
});
But I need like when clicking on particular cell only. Here I used third cell.
//$("table tr").find('td').eq(2).click(function() {