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..
<div id="container">
<div onclick="swapDiv(event);">1</div>
<div onclick="swapDiv(event);">2</div>
<div onclick="swapDiv(event);">3</div>
</div>
if DIV 2 has been clicked it should be swap with DIV 1
This code will do what you want (if you want to swap the selected with the first child element). In case you want something else you need to be more precise.