用jQuery删除表行最好的方法是什么?
当前回答
简单. .试试这个
$("table td img.delete").click(function () {
$(this).parent().parent().parent().fadeTo(400, 0, function () {
$(this).remove();
});
return false;
});
其他回答
另一个是empty():
$(this).closest('tr').empty();
简单. .试试这个
$("table td img.delete").click(function () {
$(this).parent().parent().parent().fadeTo(400, 0, function () {
$(this).remove();
});
return false;
});
以下是可以接受的:
$('#myTableRow').remove();
$('#myTable tr').click(function(){
$(this).remove();
return false;
});
甚至是更好的
$("#MyTable").on("click", "#DeleteButton", function() {
$(this).closest("tr").remove();
});
这无疑是最简单的方法:
$("#your_tbody_tag").empty();