I'm confused about the JQuery UI sortable events handler. How can I make a function fire everytime there is a change e.g. $("#tablename tbody").sortable({ change: myfunction() });
2 Answers
in this way:
$( ".selector" ).sortable({
change: function(event, ui) {
//code goes here
}
});
or
$( ".selector" ).bind( "sortchange", function(event, ui) {
//code goes here
});
Documentation: http://jqueryui.com/demos/sortable/#event-change
2 Comments
Snake Eyes
provide full jquery code ... depdending how you wrote the function
Barney
The bind for some reason wouldn't work, but I've done it the other way now :) Thanks
"change" event will be fired only if DOM position has changed. You can use sort event to catch any sorting if that is what you want.