title: Dynamically Add & Remove HTML Form
body: <p>I have a one form to add link of any site. After submit it will store in DB.</p>
  
  <p>Problem:- 
  When i click on add form button it will add one new form to add link of site. if user want to enter 5 site link then he will click 5 times on add form button and so on.but when user submit form then i validate the links and if it is invalid then it will throw the error message.</p>
  
  <p>When i am adding form i am also adding remove button. Before submit form it will work fine but after submit form the remove button not working.</p>
  
  <p>Code:-</p>
  
  <pre><code>function addLinkFrom() 
  {
  var div = document.createElement('div');
  div.className = 'linkform';
  div.innerHTML = '&lt;label class="linklabel"&gt;Add Link: &lt;/label&gt;&lt;input type="text" id="txtaddlink" name="txtaddlink[]" class="expfield" placeholder="Enter Link"/&gt;\
      &lt;div class="clearboth"&gt;&lt;/div&gt;\
      &lt;input type="button" class="btn linkpad btn-primary" value="Remove" onclick="removeLinkForm(this)"&gt;\
      &lt;div class="line"&gt;&lt;/div&gt;';
      document.getElementById('addlinkform').appendChild(div);
  }
  
  function removeLinkForm(input) 
  {
  document.getElementById('addlinkform').removeChild( input.parentNode );
  }
  </code></pre>
  
  <p>so if you have any idea to solve this please share it with me.</p>