开发者

how do I move list elements in jQuery UI Sortable without the mouse, purely in jQuery?

开发者 https://www.devze.com 2022-12-16 21:36 出处:网络
I want to just set up a link that allows the user to jump a given sortable list element to the top of the list. I need something like

I want to just set up a link that allows the user to jump a given sortable list element to the top of the list. I need something like

$('.sortable li:last-child').move('开发者_StackOverflow中文版.sortable li:first-child');

...where I can just cause a link to pop any list element up to the top of the list.

Never mind! I found the answer. $(id).prependTo($('#list'));


Not sure if it's the best solution but this should work.

$('.sortable li:last-child').live('click', function() {
    $(this).prependTo('.sortable');
});

Kind of hard to help further without seeing more code.

0

精彩评论

暂无评论...
验证码 换一张
取 消