OnClicking for any <li><a>....</a></li> element, except for the last child element, this element should be moved to the beginning as the first child <ul> element.
Description
Default:
<ul> <li><a href="#">01</a></li> <li><a href="#">02</a></li> <li><a href="#">03</a></li> <li><a href="#">04</a></li> <li><a href="#">05</a></li> <li><a href="#">06 (Last Child)</a></li> </ul>
If I click on 03 , this list should look like this.
<ul> <li><a href="#">03</a></li> <li><a href="#">01</a></li> <li><a href="#">02</a></li> <li><a href="#">04</a></li> <li><a href="#">05</a></li> <li><a href="#">06 (Last Child)</a></li> </ul>
But if you click on the last child <li> , this element should not be moved or resized ... the last child should always be the last.
jquery
Reddy
source share