Clone
and change id

前端 未结 4 1929
伪装坚强ぢ
伪装坚强ぢ 2020-12-01 06:30

How can I using javascript make clone of some

and set his id different from original. Jquery also will be nice.

4条回答
  •  生来不讨喜
    2020-12-01 06:42

    Use it:

    JQuery

    var clonedDiv = $('#yourDivId').clone();
    clonedDiv.attr("id", "newId");
    $('#yourDivId').after(cloneDiv);
    

提交回复
热议问题