Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
40
rated 0 times [  42] [ 2]  / answers: 1 / hits: 25840  / 11 Years ago, thu, april 4, 2013, 12:00:00

How to call a function once after change() event complete?



for example, something like this: ( I know jQuery Doesn't have callback method as default )



$('#element').change( function(){
// do something on change
// $('#milestonesSelect').multiselect({ minWidth: 120 , height : '200px' ,selectedList: 4 }).multiselectfilter();
// some animation calls ...
// ...
}, function(){
// do something after complete
alert('another codes has completed when i called');
}
);


Is it possible to call a single callback after all the codes on change method done, except call a complete callback for every functions on it?



I need to do something after the change event has completed



Shall I need to set order to methods in change handler?


More From » jquery

 Answers
14

You can probably make use of event bubbling and register a callback in the document.



$(document).on('change', '#element', function(){
console.log('after all callbacks')
});


Demo: Fiddle


[#79129] Tuesday, April 2, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kaleyv

Total Points: 259
Total Questions: 99
Total Answers: 107

Location: Saint Helena
Member since Tue, Nov 3, 2020
4 Years ago
;