title: How to add an HTML form element dynamically using javascript
body: <p>I'm trying to add a text field to a form dynamically using javascript. From what I can tell, my code should work.</p>
  
  <pre><code>function change()
  {
  textField = document.createElement("text");
  textField.id="sub"+count;
  textField.name="sub"+count;
  textField.value="Enter a name for another new subcategory";
  textField.size="35";
  textField.onchange="javascript:change()";
  textField.onFocus="javascript:clearField()";
  document.getElementById("addCatForm").appendChild(textField);
  }
  </code></pre>