0

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 2

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

provide full jquery code ... depdending how you wrote the function
The bind for some reason wouldn't work, but I've done it the other way now :) Thanks
0

"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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.