juery动态添加和删除

拼语句添加框(不能删除原有的tr)

//点击a标签
$("#a").on("click",function(){
var $newtr = $("<tr id='model'>"
+"<td><input type='text' name='contacts.contactName' value=''></td>"
+"<td><input type='text' name='contacts.contactTel' value=''></td>"
+"<td><input type='text' name='contacts.contactFax' value=''></td>"
+"<td><input type='text' name='contacts.contactEmail' value=''></td>"
+"<td><input type='text' name='contacts.contactRole' value=''></td>"
+"<td ><a href='javascript:void(0);' class='del'>删除</a></td>"
+"</tr>");
$newtr.find(".del").click(function(){
$(this).parents("tr").remove();
});
$("#fourdiv").append($newtr);
});

删除之前有的tr

$(".del").click(function(){
$(this).parents("tr").remove();
});

效果图

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA7UAAADtCAIAAADvDsVlAAAbWklEQVR4nO3d33Lb5p2H8fdG0MuINKAuos7J3gFiUe5xZ4+6dyBIsnLcZnPSyWRS/cMeeDxJXe/sQSRZtmenmyCOXGcmXVWyRGq16569e/ACeEGQoBWmIoAvn8/ggJEoip2fX/ARCoLGAgAAAMiZpp8AAAAA0CL0MQAAAODRxwAAAIBHHwMAAAAefQwAAAB49DEAAADg0ccAAACARx8DAAAAHn0MAAAAePQxAAAA4NHHAAAAgEcfAwAAAB59DAAAAHj0MQAAAODRxwAAAIBHHwMAAABeqY9TGxobJdkNM7Yl7m6JNcbG6T/ySUTlx88l0chvjxIb5b83ja0J7ZSnUPzs+POMw/f8LAAAABbZSB+no+0bh9ZEYz8xep80rlbsT+U7uPK7UhsaG6c2iawJbZraKH8+cZj3dE3KTyl4+hgAAABT1J9fkdrQ2DAe+VrlmK4JbRLnMZrM0scur8PY36g8Ad/HxWHjSb/IFXM5fKOxA9LF1ydEPwAAAGCtLfexK9SkaM3xzWVlfvzYZevP6ePs2HNeqy6+fSKXjw3nv2jisWp3eka5raO6g9nuMTl+DAAAgBqlPk79uQeuXP25yOUDrv+gPi7XcPF7s+PT7teNHT+2pYivPE5dOo/91vecfQEAAIAFN+H8iuqpDvlx3KT03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AAgEcfAwAAAB59DAAAAHj0MQAAAODRxwAAAID3//XavUDYmsOUAAAAAElFTkSuQmCC" alt="" />

上一篇:SqlServer 查询表、表说明、关联表、字段说明,语句汇总


下一篇:SELinux一键开启与禁用脚本