日期:2014-05-16  浏览次数:20377 次

jquery如何遍历新添加元素,下面这个each遍历不到
$("#addProduct").click(function(){
if($("#new_tr").length==0){
$("#end_tr").before("<tr id='new_tr' name='child' >"+
"<td><input type='checkbox'/></td>"+
"<td></td>"+
"<td></td>"+
"<td></td>"+
"<td></td>"+
"<td></td>"+
"</tr>");
}

});
$("#deleteProduct").click(function(){

$("input[name='child']").each(function(){

if($(this).attr("checked")=="checked"){
$(this).parent().parent().remove();
}
});
});
------解决方案--------------------
$("input[name='child']") 你的name=‘child’是tr不是input啊