最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Jquery UI sortable not working - Stack Overflow

programmeradmin0浏览0评论

I've been trying to get the sortable function to work, searched a lot of articles but so far no success.

The basics are just get the simple ul to bee sortable like the nice example on jqueryui The problem being, i'm doing everything as suggested but it's just ignoring me.

here is what i currently have: /

html:

<ul id="sortable">
    <li id="item_1">bla</li>
    <li id="item_2">bla</li>
</ul>

js in the onload(and no onload is not in fact the problem)

$(function () {
    $('#sortable').droppable({
        tolerance: 'touch',
        drop: function () {
            alert('delete!');
        }
    });
    $('#item').sortable();
});

EDIT: ah got it, was using a wrong jquery ui lib

I've been trying to get the sortable function to work, searched a lot of articles but so far no success.

The basics are just get the simple ul to bee sortable like the nice example on jqueryui. The problem being, i'm doing everything as suggested but it's just ignoring me.

here is what i currently have: http://jsfiddle/N63qQ/

html:

<ul id="sortable">
    <li id="item_1">bla</li>
    <li id="item_2">bla</li>
</ul>

js in the onload(and no onload is not in fact the problem)

$(function () {
    $('#sortable').droppable({
        tolerance: 'touch',
        drop: function () {
            alert('delete!');
        }
    });
    $('#item').sortable();
});

EDIT: ah got it, was using a wrong jquery ui lib

Share Improve this question asked Nov 1, 2013 at 10:38 Mark ProssMark Pross 451 gold badge1 silver badge8 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

it should be sortable, not dropable. Here is your code http://jsfiddle/N63qQ/4/

$(function () {
$('#sortable').sortable({
    tolerance: 'touch',
    drop: function () {
        alert('delete!');
    }
});
$('#item').sortable();
});

You also forgot to include Jquery UI in your code

发布评论

评论列表(0)

  1. 暂无评论