var original = document.getElementById("question_format"); var clone = original.cloneNode(true); clone.removeAttribute("id"); clone.setAttribute("id", "question"); document.getElementById("testform").appendChild(clone);