title: How to swap HTML elements in javascript?
body: <p>I am using classic Javascript for DOM scripting, i have a set of DIV's in a container DIV.
  On click event of child DIV's, i want that the child DIV which has caused event to be swaped with the DIV above it..
  my code goes here..</p>
  
  <pre><code> &lt;div id="container"&gt;
          &lt;div onclick="swapDiv(event);"&gt;1&lt;/div&gt;
          &lt;div onclick="swapDiv(event);"&gt;2&lt;/div&gt;
          &lt;div onclick="swapDiv(event);"&gt;3&lt;/div&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>if DIV 2 has been clicked it should be swap with DIV 1</p>