I am trying to get the row index of a table with the help of jquery using the alert function but I am not able to get any output . When I click on the edit button there is no action
<html>
<head>
<script type="text/javascript">
function check(){
$("table tr").click(function() {
alert( this.rowIndex ); // alert the index number of the clicked row.
});
}
</script>
</head>
<table>
<tr>
<td> <input type="button" name="test" value="Edit" id="amol" onclick="check();"/> </td>
</tr>
</table>
</html>
Please help me with this!