title: change the order of elements to the top
body: <pre><code>   &lt;div id="container"&gt;
          &lt;div id="1"&gt;1&lt;/div&gt;
          &lt;div id="2"&gt;2&lt;/div&gt;
          &lt;div id="3"&gt;3&lt;/div&gt;
          &lt;div id="4"&gt;4&lt;/div&gt;
     &lt;/div&gt;         
  </code></pre>
  
  <p>how to move the <code>div</code> #4 to the top using pure javascript
  I saw <a href="https://stackoverflow.com/questions/7742305/changing-the-order-of-elements-using-javasript">this</a> but it's working only to move elements to the bottom. for example that will work to move #1 to the bottom. it will work to move #4 to the top by moving all the other elements to the bottom. isn't there a direct way to move #4 to the top?. </p>