2010-08-19 82 views
1

我有一个表,并在其中一个TD里面的隐藏字段存储的主键。而删除表行我想取回这个值,并将其添加到另一个隐藏字段删除表行jQuery的

我想要检索的隐藏字段中的数据为这个删除的行?

回答

2

当你删除该行有可能会使用.find()这样使用.remove()你仍然可以查询它的元素,例如:

$(".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