Is it possible to have a defined function as a handler to jQuery’s $(document).ready() instead of anonymous function ?
I’ve done several experiments but to no avail. One of them is here : http://pastebin.com/XHKPc879.
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.
Sure, a regular function is a function just like an anonymous one is.
Here’s a working fiddle.
In your example, you’re actually calling the function and passing its return value to the document read, because you have the closing
()on it. Leave those off, and it should work.Of course, if you call a function that returns a function, that works too.
EDIT
First link:
Second link: