0
我已经附加了输入元素表行到现有的表如下:我如何maniputate jQuery的追加到现有的表的表行
$("#additems_table").append(
"<tr><td style='color:#999; font-size:16px;'>"+(counter++)+"</td><td>
<select class='item'><?php while($product_rows=mysql_fetch_assoc($productSQL)){?><option value='<?php echo $product_rows['pid']; ?>'><?php echo $product_rows['name']; ?></option><?php }?></select></td><td id='quantity_td'><input name='quantity' class='quantity' type='text' style='width:35px' id='cost"+(numqty++)+"' /><input type='hidden' name='price_hf' id='cost"+(numprice++)+"'/></td><td id='amount_td'><input name='amount' id='cost"+(numamount++)+"' style='width:70px' type='text' value='3' disabled='disabled'/></td></tr>");
});
问题进来时,我试图操纵中的这些元素以上附加的行。它根本不听任何事件,点击,改变等。例如
$("#additems_table input[type=text]").each(function(){
$(this).change(function(){
alert("amount");
});
})
我真的很感谢帮助。
请你可以发布一个格式化的代码示例,理想的代码传递给浏览器,而不是jQuery和php的组合。 – 2011-02-14 15:18:03