title: Javascript removeChild array
body: <p>this looks simple enough but I just can't get it to work. I could add DOM elements but I just can't remove them when using an array.</p>
  
  <pre><code>&lt;script language="javascript"&gt;
  fields = 0;
  count = 0;
  function addInput() {
    if (fields != 10) {
        var htmlText =  "&lt;input type='search' value='' name='field[]' /&gt;";
        var remButton = "&lt;input type='button' value='del' onclick='remove()' /&gt;";
        var newElement = document.createElement('div');
  
        newElement.id = 'SomeID'+fields; 
        newElement.innerHTML = htmlText + remButton + newElement.id;
  
        var fieldsArea = document.getElementById('text');
        fieldsArea.appendChild(newElement);
  
        fields += 1;
    } else {
       ...
    }
  count++;
  }
  
  // NEED HELP FROM HERE PLEASE
  // You don't need to Loop, just get the button's id and remove that entire 'SomeID'
  
  
  function remove() {
    fieldsArea = document.getElementById('text');
  
  
    fieldsArea.removeChild(SomeID1);   &lt;-----------------------THIS WORKS!
    fieldsArea.removeChild(SomeID+count); &lt;------------------THIS JUST WOULDN'T
  
    count--;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>In the remove function, writing SomeID1 works and delete the first added element but when I try to use a 'count', I just can't delete my 'elements'.</p>
  
  <p>Any help would be most appreciated.</p>
  
  <p>Thank you!</p>