i am trying to find out the Right sequence of the method execution in the jquery.
here is the sample script.
$(document).ready(function(){
$("#start").click(function(){
$("div").fadeOut(function(){
console.log("i am no 1");
}).fadeIn(function(){
console.log("i am no 2");
}).show('slow',function(){
console.log('i am no 3');
});
});
});
So, when i click the button with id="start". then the o/p in the console should be
i am no 1
i am no 2
i am no 3
but the actual o/p is
i am no 1
i am no 3
i am no 2
so, i want to know how to know how to decide the sequence of execution of the method in jquery script? what is the basis of priority ???
I can only reproduce this problem in a jsFiddle when using jQuery versions older than 1.6.4. If you use 1.6.4 or newer, the jsFiddle works in all browsers I’ve tried.
My guess is that you’re either trying to use a capability that wasn’t implemented until 1.6 or you’re running into a buggy behavior that wasn’t fixed until 1.6.
You can see the working order here with jQuery 1.8.0: http://jsfiddle.net/jfriend00/tgraD/
You can see the failed order here with jQuery 1.5.2: http://jsfiddle.net/jfriend00/SJns7/