How to create an Html element again when the user clicks a button

I did create a Html form tag and Html button tag.

Now I want to create again form tag when the user clicks my button

I think this is possible with JavaScript

If anyone knows please help me



Here is a sample code. This will add the form once.

let form = document.getElementsByClassName('sample-form')[0]

//make copy of the original form using cloneNode(true). true means JS will copy all the nodes inside of the form element. It's called "deep copy".  
function duplicateForm(){
  return form.cloneNode(true);

let addForm = document.getElementById('add-form')

addForm.addEventListener('click', function(){
<form class="sample-form">
  <input placeholder="Your value here"/>

<button id="add-form">Add New Form</button>