title: Dynamically created form fields keep having the same ID
body: <p>I dynamically add some text fields to my page with this line of code:</p>
  
  <pre><code>var textboxCount = 0;
  
  $('#addFields').on('click', function(){
  
  var TextField = document.createElement("input");
  
  TextField.setAttribute("type", "text");
  TextField.setAttribute("value", textboxCount);
  TextField.setAttribute("name", "textbox");
  TextField.setAttribute("class", "foo");
  TextField.setAttribute("id", "textbox" + textboxCount);
  TextField.setAttribute('onkeyup','doSomething('+textboxCount+');'); // for FF
  TextField.onkeyup = function() {doSomething(textboxCount);}; // for IE
  
  jQuery('#TextfieldList').append(eleText);
  textboxCount += 1; //Increment the count
  
  });
  </code></pre>
  
  <p>Now I need the unique ID of the field in this function:</p>
  
  <pre><code>function doSomething(id){
      alert(id);
  }
  </code></pre>
  
  <p>But when I call the function, I keep getting the same ID with every added field. The value in the textfield is correct though.</p>