A lot of time I see jQuery code that looks like this:
$('a').live( 'click', function(event){
..
});
What does the event parameter do? Does it correspond to the element ‘a’ or the event ‘live’?
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.
It means that every anchor element on the page (
a) as well as any dynamically added anchor elements in the future will have a click event attached to them that will run whatever the function is passed in.jQuery documentation of the
livemethodthe parameter
eventof the function that is passed in is the result of a click on an anchor element. If you are using Firefox with Firebug you can examine this object by doing this:When you click on an anchor you will then be able to see the whole object in the Firebug console.