I’m currently working on records that is tabulated in HTML, records are from the database and on the end part of that table, i have some actions, EDIT DELETE SHOW, i’ve already done the edit, which is NOT the same as my DELETE, my DELETE action is done using ajax, but the problem is that i can’t properly get the value of each button, which contains the ID from the database.
This is part of the table where the delete button is located:
<td width="61"><button id="delete" value="<?php echo "$arr[0]"; ?>">Delete</button></td>
These is the jQuery part
$("#delete").click(function(){
alert($("#delete").val()); <-- CAN"T GET THE CORRECT ID
//AJAX PART HERE
})
The problem is that i can’t correctly get the value of the button which i pressed, how do i do this, any suggestions are greatly appreciated..
This is the whole view of the table,

Not tested, but I expect the issue is that you are trying to get the
val()of all the matches for#delete, which is probably all of your delete buttons (I can not know without seeing your generated HTML).You should actually use a class of
deleteand select with.deleterather than anid, as anid, according to the HTML specification should refer to a unique element.