Possible Duplicate:
What is the meaning of “$” sign in javascript
what difference does the $ at the beginning of anonymous function?
This Example:
(function() {
...
})();
Versus this one:
$(function() {
...
})();
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 line above is creating an anonymous function and then executes it right away
Assuming you have jQuery loaded, the line above causes an error. This part $(function(){}) will pass an anonymous function into jQuery that gets run. jQuery will return a Document object back to you. Because you have the ending parenthesis () the Javascript will try to execute the Document object as a function. Because the Document object is not a function, a TypeError exception will be raised.