Pablo Mosby
Pablo Mosby

Reputation: 319

Jquery UI sortable Change not working correctly

I have this code for initilazing my sortable ul, but both methods only render 1 item of the list and not the whole of it, with the stop event everything is fine, but I need to use the change event, what is the problem?

Thanks in advance.

API JQUERY SORTABLE

 $( "#sortable-ul" ).sortable({
    scroll: true,
    items: "> li",
    change: function() {
        console.log($("#sortable-ul").sortable("toArray"));
        console.log($("#sortable-ul").sortable("serialize"));
    }
  });

Upvotes: 0

Views: 963

Answers (1)

Haseeb Ibrar
Haseeb Ibrar

Reputation: 437

Try this code:

$( "#sortable-ul" ).sortable({
    scroll: true,
    items: "> li",
    update: function() {
        console.log($("#sortable-ul").sortable("toArray"));
        console.log($("#sortable-ul").sortable("serialize"));
    }
});

Upvotes: 2

Related Questions