Mark Pross
Mark Pross

Reputation: 45

Jquery UI sortable not working

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 become sortable like the nice example on jqueryui.com The problem being, i'm doing everything as suggested but it's just ignoring me.

here is what i currently have: http://jsfiddle.net/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

Upvotes: 2

Views: 14825

Answers (1)

Maxim Ershov
Maxim Ershov

Reputation: 1284

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

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

You also forgot to include Jquery UI in your code

Upvotes: 5

Related Questions