I am trying to use jQuery to delete rows in a table. The table presents a button as the first item in a row. clicking on that button should delete that row from a MySQL table.
Here is the javascript code
$("#list .del").click(function() {
cell = $(this);
row = cell.closest("tr");
vid = row.find (".vid");
alert (vid.text());
$.post ("db_deleteplayer.php",
{vid:vid.text()},
updateSignup);
return;
}) //#list .del click
function updateSignup(data) {
$('#list').html(data);
return;
}
This works perfectly for the first row I want to delete but fails thereafter. I've confirmed this in Firefox, Chrome, and IE.
My guess is that the first deletion is modifying the DOM and jQuery gets confused. Could someone please explain where I'm going wrong?