0
我创建了侧一排动态删除最后一个动态生成HTML行创建的jQuery
var index = 1;
$("#add_field").click(function(){
var new_field = '<tr><th style="text-align: left;">Customer '+index+'</th><td><input type="text" id="customer'+index+'" name="customer'+index+'" maxlength="50"></td><th style="text-align: left;">Phone</th><td><input type="text" id="customerphone'+index+'" name="customerphone'+index+'" maxlength="14"></td><th style="text-align: left;">Email</th><td><input type="text" id="customeremail'+index+'" name="customeremail'+index+'" maxlength="100"></td></tr>';
$("#customerFormTable").append(new_field); });
HTML
<div id="add_field">Click here to add more rows </div>
我现在该如何建立一个删除表 - 删除最后一行我刚刚创建
<div id="delete_row">Click here to delete last row created </div>
$("#delete_row").click(function(){ ??????
谢谢你的答案。他们帮我完成了。这里是我写的 首先,当我创建了TR动态我给它的ID
相关问题