I'm currently working with a dynamic table and facing an issue retrieving the value of a hidden field called order_id
. The problem is that I am only able to get the value of the first id
even when clicking on buttons in other rows. Here is the code snippet I am using :
<tr>
<td>id</td>
</tr>
<tr>
<td>
<input type="hidden" id="hid" value="<?php echo $id; ?>">
<input type="button" id="sends" value="Send" onclick="sendemails();">
</td>
</tr>
<script>
function sendemails(){
var sends = $('#sends').val();
var hid = $('#hid').val();
alert(hid);
}
</script>