tumoxep tumoxep - 2 years ago 208
jQuery Question

Clone <div> and change id

How can I using javascript make clone of some

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

Answer Source
var div = document.getElementById('div_id'),
    clone = div.cloneNode(true); // true means clone all childNodes and all event handlers
clone.id = "some_id";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download