I am having a problem on this because I always get the first value even if I click the last element of the table.

```
<table>
<?php 
    for($i=1;$i<=5;$i++){
?>
<tr>
   <td><input type="text" id="testId" value="{$i}"><td>
   <td><button class="testButton">Click Me</button></td>
</tr>
<?php
}
?>
</table>

```

for js file

```
$(document).ready(function(){
   $( ".testButton" ).click(function(){
          var a = document.getElementById("testId").value;
          alert(a);
   });
});

```

how can I get each value?