これをテーブルに追加したいのですが、追加ボタンをクリックすると、2 つの行が同時に追加されます。つまり、ループが 2 回実行されます。しかし、行を削除しても問題ありません。
$(document).ready(function() {
$(".add_partners_details").click(function() {
var newrow = $('<div class="t-row"><div class="t-col"><input type="text" class="text_field txtNumeric" name="partners_or_directors_sl_no_id[]" value="" placeholder=""/></div><div class="t-col"><input type="text" class="text_field txtNumeric" name="partners_or_directors_pin_id[]" value="" placeholder=""/></div><div class="t-col end"><input type="text" class="text_field required txtAlphabet" name="partners_or_directors_name_id[]" value="" placeholder=""/></div><div class="t-col border_none"><a href="javascript:void(0);" class="remove_partners_details">Remove</a></div></div>');
$("#details_of_partners_directors").append(newrow);
});
$("#details_of_partners_directors").on('click','.remove_partners_details',function() {
$(this).parent().parent().remove();
});
});
HTML
<div class="t-row">
<div class="t-col">
<input type="text" class="text_field txtNumeric"name="partners_or_directors_sl_no_id[]" value="" placeholder=""/>
</div>
<div class="t-col">
<input type="text" class="text_field txtNumeric" name="partners_or_directors_pin_id[]" value="" placeholder=""/>
</div>
<div class="t-col end">
<input type="text" class="text_field required txtAlphabet" name="partners_or_directors_name_id[]" value="" placeholder=""/>
</div>
<div class="t-col border_none">
<a href="javascript:void(0);" class="add_partners_details">Add</a>
</div>
</div>