jquery - Multiple $(document).ready functions -
this question has answer here:
- jquery - multiple $(document).ready …? 5 answers
if have multiple $(document).ready(...) functions, overwrite each other? sake of argument, pretend proper coding thrown out door on one.
say have $(document).ready(function() {...}); in site's script file. use third party plugin uses $(document).ready(function() {...});. overwrite created function or jquery "queue" these functions run when document ready?
no, not override each other. each function executed.
you of course check yourself: http://jsfiddle.net/6jggt/
or understand jquery code itself:
line 255 ready function jquery.bindready(); called among other things initialises readylist object on line 429 readylist = jquery._deferred();
and once it's deferred object function passed in appended readylist.done( fn ); , can see in done method on line 41 element added array callbacks.push( elem ); each 1 saved separately...
Comments
Post a Comment