javascript - Change id of clone children in jQuery -
i have table on have hidden line clone in order add new lines dynamically.
var $clone = $('#table-invoicing').find('tr.hide').clone(true).removeclass('hide'); $('#table-invoicing').find('table').append($clone);
each line have id , data-type. hidden line set id ending in 99. change id when clone hidden line.
i found similar topics, reason don't manage include in script. when clone line, there 2 elements same id, selector id won't work.
i tried :
$clone.$('#invoicing-row-descr-99').attr("id", "newid");
but tells me $clone not function.
any idea ?
$clone.$('#invoicing-row-descr-99').attr("id", "newid");
but tells me $clone not function.
because $clone object. use attr or prop cloned element:
$clone.attr("id", "newid");//change cloned element id
as per comment, use this:
$clone.find('your_element').attr("id", "newid");
Comments
Post a Comment