title: Removing specific form element using javascript
body: <p>I'm trying to create to remove a form element using javascript. When I remove an element, it removes the topmost element. I'm trying to remove a specific element. Here is a link to the page and below is the code. Any help would be appreciated, thanks!
  <a href="http://training.cvrc.virginia.edu/test.html" rel="nofollow">http://training.cvrc.virginia.edu/test.html</a></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var patient = 0;
  function add_patient() {
  patient++;
     var add= document.createElement('patientdiv');
     add.innerHTML += "&lt;div id=removepatient&gt;&lt;/br&gt;Patient "+patient+" Name/ID:&lt;input type=text name=patients[] &gt;&lt;input type=button id=more_fields onclick=removepatient(); value='Remove' &gt;&lt;/div&gt;";
     document.getElementById('patientdiv').appendChild(add);
     return false;
  }
  
  function removepatient() {
      var elem = document.getElementById('removepatient');
     elem.parentNode.removeChild(elem);
     return false;
  }
  &lt;/script&gt;
  
  
  &lt;div id=patientdiv&gt;&lt;/div&gt;
  &lt;input type=button id=more_fields onclick=add_patient(); value='Add Patient'&gt;&lt;/br&gt;&lt;/br&gt;
  </code></pre>