Move list item to top of unordered list using jQuery

前端 未结 5 638
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-01 04:22

Lets say i have the following unordered list

  • Hank
  • Alice
5条回答
  •  北海茫月
    2020-12-01 05:02

    Found this even neater:

    $('li').on('click', function() {
        $(this).parent().prepend(this);
    });​
    

    Live example

提交回复
热议问题