jQuery可以';不删除动态添加的行

jQuery可以';不删除动态添加的行,jquery,append,row,Jquery,Append,Row,是否有什么东西阻止了这项工作,我正在动态地向表中添加一行,然后如果他们单击新行(或表中的任何行),它应该消失……但它不工作 $('.addtocart').click(function(){ var omPartNo = $(this).next().text(); var supPartNo = $(this).next().next().text(); var cat =

是否有什么东西阻止了这项工作,我正在动态地向表中添加一行,然后如果他们单击新行(或表中的任何行),它应该消失……但它不工作

$('.addtocart').click(function(){
                    var omPartNo = $(this).next().text();
                    var supPartNo = $(this).next().next().text();
                    var cat = $(this).next().next().next().text();
                    var desc = $(this).next().next().next().next().text();
                    var manuf = $(this).next().next().next().next().next().text();
                    var list = $(this).next().next().next().next().next().next().text();
                    var disc = $(this).next().next().next().next().next().next().next().text();
                    var priceEach = $(this).next().next().next().next().next().next().next().next().text();
                    $('#cart table').append('<tr class="tableRow"><td><a class="removeItem" href="#"><img src="/admin/images/delete.png"></img></a><td>' + omPartNo + '</td><td>' + supPartNo + '</td><td>' + cat + '</td><td>' + desc + '</td><td>' + manuf + '</td><td>' + list + '</td><td>' + disc + '</td><td>' + priceEach + '</td></tr>');
                });

                $('.tableRow').click(function(){
                    $(this).remove();
                });
$('.addtocart')。单击(函数(){
var omPartNo=$(this.next().text();
var supPartNo=$(this.next().next().text();
var cat=$(this.next().next().next().text();
var desc=$(this.next().next().next().next().text();
var manuf=$(this.next().next().next().next().next().text();
var list=$(this.next().next().next().next().next().next().next().text();
var disc=$(this.next().next().next().next().next().next().next().text();
var priceEach=$(this.next().next().next().next().next().next().next().next().text();
$(“#购物车表”)。附加(“”+omPartNo+“”+supPartNo+“”+cat+“”+desc+“”+manuf+“”+list+“”+disc+“”+priceEach+“”);
});
$('.tableRow')。单击(函数(){
$(this.remove();
});
使用,如下所示:

$('.tableRow').live('click',function(){
    $(this).remove();
});
像这样使用:

$('.tableRow').live('click',function(){
    $(this).remove();
});

杰出的我试着接受你的回答,但上面说等8分钟!?谢谢我感谢您的耐心:)$('.removietem').live('click',function(){$(this,'.tableRow').remove();});任何想法如何修复上述,我想点击一个图像,并为它删除其在??我需要多个选择器吗?比如:$('.removietem').live('click',function(){$(this.parent().remove();})$('.removietem').live('click',function(){$(this).closest('tr').remove();});现在,即使它嵌套在另一个元素中,它也会删除它所在的行:-)太好了!我试着接受你的回答,但上面说等8分钟!?谢谢我感谢您的耐心:)$('.removietem').live('click',function(){$(this,'.tableRow').remove();});任何想法如何修复上述,我想点击一个图像,并为它删除其在??我需要多个选择器吗?比如:$('.removietem').live('click',function(){$(this.parent().remove();})$('.removietem').live('click',function(){$(this).closest('tr').remove();});现在,即使它嵌套在另一个元素中,它也会删除它所在的行:-)