Answer the question
In order to leave comments, you need to log in
The last line is not clear, what does this mean, besides the fact that we are making a copy, why write input.parentElement.appendChild(clone);?
<input type="submit" id="button">
<input type="text" id="input">
var input = document.getElementById('input');
var button = document.getElementById('button');
button.addEventListener('click', func);
function func(){
var clone = input.cloneNode(true);
input.parentElement.appendChild(clone);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question