$(function() {
$('ul').on('click', 'li', function() {
//cache clicked element
var clickedItem = $(this);
//get next siblings and self, and append to first position
clickedItem.nextAll().andSelf().prependTo(clickedItem.parent());
});
});
Related Posts :