Can someone please explain the following syntax
$(function(){
$(".myPage").live("click", myHandler); // NOT THIS BIT!!
});
It looks globally defined, if that makes any difference?
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.
$(somefunction)asks jQuery to execute thesomefunctionfunction once the DOM is ready.From the documentation :
It ensures you don’t try to access objects of the DOM before they’re available. It’s a good practice to embed your main code in such a callback, in a script element at the end of the body.
Note that you may have different scripts adding such blocks. All callbacks will be executed, in the order of insertion. This is especially important to know when you have a big applications with many scripts.