title: JS - Insert element on the <div> tag
body: <p>I need to add a  tag with some Elements, but the innerHTML inserts  before appendChild.
  My Js function:</p>
  <pre><code>function addFields(){
      var isbn_container = document.getElementById(&quot;isbn_container&quot;);
      isbn_container.innerHTML += &quot;&lt;div&gt;&quot;;
      var div = document.createElement(&quot;div&quot;);
      var input = document.createElement(&quot;input&quot;);
      input.type = &quot;text&quot;;
      input.name = &quot;new-isbn-10[]&quot;;
      isbn_container.appendChild(input);
  
      var input2 = document.createElement(&quot;input&quot;);
      input2.type = &quot;text&quot;;
      input2.name = &quot;new-isbn-13[]&quot;;
      isbn_container.appendChild(input2);
      isbn_container.innerHTML += &quot;&lt;span onclick='deleted(this);'&gt; delete&lt;/span&gt;&quot;;
      isbn_container.appendChild(document.createElement(&quot;br&quot;));
      isbn_container.appendChild(document.createElement(&quot;br&quot;));
      isbn_container.after.innerHTML += &quot;&lt;/div&gt;&quot;;
  }
  </code></pre>
  <p>The result:</p>
  <pre><code>&lt;div&gt;&lt;/div&gt;
  &lt;input type=&quot;text&quot; name=&quot;new-isbn-10[]&quot;&gt;
  &lt;input type=&quot;text&quot; name=&quot;new-isbn-13[]&quot;&gt;
  &lt;span onclick=&quot;deleted(this);&quot;&gt; delete&lt;/span&gt;
  &lt;br&gt;&lt;br&gt;
  </code></pre>
  <p>But I want:</p>
  <pre><code>&lt;div&gt;
  &lt;input type=&quot;text&quot; name=&quot;new-isbn-10[]&quot;&gt;
  &lt;input type=&quot;text&quot; name=&quot;new-isbn-13[]&quot;&gt;
  &lt;span onclick=&quot;deleted(this);&quot;&gt; delete&lt;/span&gt;
  &lt;br&gt;&lt;br&gt;
  &lt;/div&gt;
  </code></pre>
  <p>Help me please.</p>