title: IE is not submitting dynamically added form elements
body: <p>I wrote some JavaScript to allow editing a list of items within an HTML form, including adding and removing items. Got it working in Firefox. When trying it in Internet Explorer, I found that any added items were not being submitted with the form.</p>
  
  <p>Long story short... lots of simplification, debugging, figured out what line is triggering IE to ignore the new form input. So the behavior problem is solved.</p>
  
  <p>But now I must ask: Why? Is this an IE bug?</p>
  
  <p>Here is the simplified code:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Test&lt;/title&gt;
      &lt;script type="text/javascript"&gt;
          function add() {
              div = document.getElementById("mylist");
  
              // *** Adding text here works perfectly fine. ***
              div.innerHTML += " ";
  
              e = document.createElement("input");
              e.setAttribute("type", "text");
              e.setAttribute("name", "field3");
              e.setAttribute("value", "--NEWVALUE--");
              div.appendChild(e);
  
              // *** Adding text here works perfectly fine in Firefox, but for
              //     Internet Explorer it causes field3 to not be submitted. ***
              //div.innerHTML += " ";
          }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action="" method="get"&gt;
          &lt;div id="mylist"&gt;
              &lt;input type="text" name="field1" value="value1" /&gt;
              &lt;input type="text" name="field2" value="value2" /&gt;
          &lt;/div&gt;
          &lt;a href="javascript:" onclick="add()" /&gt;Add&lt;/a&gt;
          &lt;input type="submit" value="Submit" /&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>To try it out, do the obvious: load in IE, click Add, click Submit, look what's in the address bar. If you uncomment the last line in <code>add()</code>, IE will suddenly stop reporting <code>field3</code>. It works fine either way in Firefox.</p>
  
  <p>Any ideas? A curious mind wants to know. (And how would I add text there if needed, in a portable fashion, so IE is happy?)</p>