【问题标题】:Append Div in respected td th在尊重的 td th 中追加 Div
【发布时间】:2016-01-08 18:22:54
【问题描述】:

我有多个 td th 并将 div 附加到 Th。单击 add_btn div 附加并从中删除。但是在从其他 tr 中单击 add_btn 时,它会在第一个 th 中附加 div。我也试过 $(this).

check the link herehttp://jsfiddle.net/vinayak5192/vj8zuy2y/

请检查所有点击添加它的广告。任何东西都只能在各自的 tr 字段中添加。

【问题讨论】:

标签: javascript jquery html dynamic append


【解决方案1】:

请在此处查看更新代码: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++) + "'/>&nbsp;<input type='button' class='remove-btn' value='X'/></div>");
                }
            });

【讨论】:

  • 好的,谢谢兄弟的帮助!
猜你喜欢
  • 2011-06-09
  • 1970-01-01
  • 2015-03-25
  • 1970-01-01
  • 2010-12-22
  • 1970-01-01
  • 2022-11-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多