Need to change li position by clicking to move up or to move down.
<div>
<ul>
<li>Item1 <a class="moveUp">Move Up</a> <a class="moveDown">Move Down</a></li>
<li>Item2 <a class="moveUp">Move Up</a> <a class="moveDown">Move Down</a></li>
<li>Item3 <a class="moveUp">Move Up</a> <a class="moveDown">Move Down</a></li>
<li>Item4 <a class="moveUp">Move Up</a> <a class="moveDown">Move Down</a></li>
<li>Item5 <a class="moveUp">Move Up</a> <a class="moveDown">Move Down</a></li>
</ul>
</div>
So what should happen here, for example, if we click Move up on Item2, the Item 2 will move up before Item 1.
I tryed to do like this, but it doesn't work:
$(".moveUp").click(function () {
var thisLine = $(this).parent();
var prevLine = thisLine.prev();
prevLine.insertAfter(thisLine);
});
Hope some one can help me...