I’m using following code to assign id of input tag when they are cloned.Is it possible to use same find method to select more tags like tr textarea etc.
var i=1;
$("#bt1").click(function() {
$("#invoice_tab tr:nth-child(2)").clone().find("input").each(function() {
$(this).attr({
'id': function(_, id) { return id + i },
'name': function(_, name) { return name + i },
'value': ''
});
}).end().appendTo("#invoice_tab");
i++;
Yes… You can try it yourself…
Just make sure the
idremain unique. There can not be more then one element in the page-DOM with the sameidvalue.