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