在尊重的 td th 中附加 Div
Append Div in respected td th
我有多个 td th 并将 div 附加到 Th。单击 add_btn div 会添加和删除。但是在其他 tr 中单击 add_btn 时,它会在第一个中附加 div。我也试过 $(this)。
check the link here
http://jsfiddle.net/vinayak5192/vj8zuy2y/
请检查点击添加它的广告在所有th。任何东西都只能添加到相应的 tr 字段中。
请在此处检查更新代码:http://jsfiddle.net/vj8zuy2y/2/
$(".add-btn").click(function () {
if (n < 8) {
$(this).parents("tr").find(".form").append("<div class='append-input' ><input type='text'name='input_" + (n++) + "'/> <input type='button' class='remove-btn' value='X'/></div>");
}
});
我有多个 td th 并将 div 附加到 Th。单击 add_btn div 会添加和删除。但是在其他 tr 中单击 add_btn 时,它会在第一个中附加 div。我也试过 $(this)。
check the link here
http://jsfiddle.net/vinayak5192/vj8zuy2y/
请检查点击添加它的广告在所有th。任何东西都只能添加到相应的 tr 字段中。
请在此处检查更新代码:http://jsfiddle.net/vj8zuy2y/2/
$(".add-btn").click(function () {
if (n < 8) {
$(this).parents("tr").find(".form").append("<div class='append-input' ><input type='text'name='input_" + (n++) + "'/> <input type='button' class='remove-btn' value='X'/></div>");
}
});