Possible Duplicate:
JQuery - multiple $(document).ready … ?
What are the implications of having multiple javascript files, each with its own $(document).ready function?
When having multiple things bind with the $(document).ready();
, the events will be hit in the order that they were bound. There are no real negative repercussions with this, but keep in mind that any variables defined in one of these methods loses scope, and won't be available in the other events.
To get around the javascript scoping issues, just define cross-ready-event variables outside of the $(document).ready();
blocks.
All functions will be executed in the order they were bound. See the jQuery documentation:
When an event reaches an element, all handlers bound to that event type for the element are fired. If there are multiple handlers registered, they will always execute in the order in which they were bound. After all handlers have executed, the event continues along the normal event propagation path.
(http://api.jquery.com/bind/)
So all functions are executed and you can influence the order in which they are executed. However, I would strongly advice against basing any logic in the execution order as this may proof pretty brittle.
nothing. They all will attach a lister to be executed when the document is ready. Only implication afaik is that they will be executed in the order they were attached.
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