does jquery support multiples of
$(document).ready(function() {});
ie. can i make a few of these on the same page and they will all be executed? or does the newest one overwrite the last?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes you can bind multiple, you can bind as many as you want, like other event handlers, they’ll execute in the order they were bound.
None will be overwritten, additionally if the document is already “ready”, it’ll execute immediately.
As a side note, there’s also a shortcut version 🙂
If you can combine them, of course do so, if you need your code to be modular and you need multiple
readyhandlers, that’s okay too, just make sure that the order is correct if it matters, usually it’s a non-issue in those cases.