JQ操作动态创建的元素

给动态创建的元素添加事件:

$(document).on('click','obj',function(){

})

删除动态创建的元素:

 $('#logisticsInfo').delegate('.delBtn','click',function(){
     if(confirm('确定删除此条物流信息?')){
         $(this).parents('tr').remove();
     }else{
         return;
     }            
 })

#logisticsInfo为父级别元素

.delBtn当前点击的子孙元素

了解更多查询delegate()方法

猜你喜欢

转载自blog.csdn.net/Abez_c/article/details/83025856