Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding duplicate elements by javascript [duplicate]

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

Image

How to do that ? I need your suggestion.Thanks in advance.

like image 732
Nijar Hossain Avatar asked Feb 17 '26 22:02

Nijar Hossain


1 Answers

You can do it with native javascript

element2 = element1.cloneNode(bool)

Here boolean indicates whether to clone child nodes or not

like image 83
Gaurav Aggarwal Avatar answered Feb 19 '26 11:02

Gaurav Aggarwal