I designed a table, and the idea is that every time I press the button of a row, I show by means of a message the ID that belongs to that row, but regardless of the button that I press always tells me the Id of the first row. below I leave the code, thanks in advance
<!doctype html>
<html>
<head>
<title>prueva</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
</head>
<body>
<table>
<thead>
<tr>
<th>nombre</th>
<th> select </th>
<th>Id</th>
</tr>
</thead>
<tbody>
<tr>
<td>Rafael</td>
<td> <input type="button" class="show_Id" value="Show ID"> </td>
<td><input type="text" value="1" class="Id"></td>
</tr>
<tr>
<td>Acosta</td>
<td> <input type="button" class="show_Id" value="Show ID"> </td>
<td><input type="text" value="2" class="Id"></td>
</tr>
<tr>
<td>cedano</td>
<td> <input type="button" class="show_Id" value="Show ID"> </td>
<td><input type="text" value="3" class="Id"></td>
</tr>
</tbody>
</table>
</body>
</html>
<script type="text/javascript">
$(document).ready(function(){
$('.show_Id').click(function(){
var id= $('.Id').val();
alert(id);
});
});
</script>