I realized that I can specify $(document).ready(function(){});
more than once.
Suppose like this
$(document).ready(function(){
var abc = "1122";
//do something..
});
$(document).ready(function(){
var abc = "def";
//do something..
});
Thanks.
Yes, it's standard and recommended and jQuery guarantees those functions will be executed in order of declaration (see this related answer for details regarding the implementation).
The abc
variable are local to your functions and don't interfere. You cannot see the value of abc
declared in one of the callbacks from the other one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With