I am new in Javascript.I need to add duplicate same elements when I click on add more button to add the whole body elements dynamically.Here are the image of my code
How to do that ? I need your suggestion.Thanks in advance.
I am new in Javascript.I need to add duplicate same elements when I click on add more button to add the whole body elements dynamically.Here are the image of my code
How to do that ? I need your suggestion.Thanks in advance.
 
    
     
    
    You can do it with native javascript
element2 = element1.cloneNode(bool)
Here boolean indicates whether to clone child nodes or not
 
    
    You can do it easily in js easily via cloneNode
function cloneFunction() {
    var para = document.getElementById("para-1");
    var cln = para.cloneNode(true);
    document.getElementById("parent").appendChild(cln);
}<div id="parent">
<p id="para-1">Lorem Ipsum</p>
</div>
<button onclick="cloneFunction()">clone it</button>