Are these both the same thing, i.e. ways of saying document ready:
$(function() {
//
});
and
$(function($) {
//
})(jQuery);
or is there a difference between the two, if so then when should I use which?
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.
The first one is a shortcut for
.ready().The second one is simply invalid as you’re trying to call a non-callable object.
You probably meant this:
…though it has nothing to do with DOM ready.
There is a variation on your first example that combines the two: