user415772
user415772

Reputation: 431

Delete table row in jquery

i have a table and a hidden field inside a td in it which stores the primary key .while deleting the table row i like to retrieve this value and add it to another hidden field

i want to retrieve the data in hidden field for this deleted row ??

Upvotes: 1

Views: 270

Answers (1)

Nick Craver
Nick Craver

Reputation: 630569

When you delete the row, likely using .remove() you can still query it's elements, for example using .find() like this:

$(".delete").click(function() {
  var id = $(this).closest("tr").remove().find("input[type=hidden]").val();
  //do something with the ID
});

You can give it a try here

Upvotes: 2

Related Questions