Each div has two buttons: above and below. When "higher" is pressed, if this div is not in the upper position, it moves above the original. When the "lower" button is pressed, the item will be moved below the original.
The question arises: how can elements move up and down relative to another element?
<div>
<div id="a1">a1<input name='higher' type='button' value='higher'/><input name='lower' type='button' value='lower'/></div>
<div id="a2">a2<input name='higher' type='button' value='higher'/><input name='lower' type='button' value='lower'/></div>
<div id="a3">a3<input name='higher' type='button' value='higher'/><input name='lower' type='button' value='lower'/></div>
</div>
source
share