I would like to know why it’s better to use observers rather than adding the action directly into the onclick=””.
eg.
$('mybutton').observe('click', respondToClick);
vs
<a href="#" onclic="respondToClick()">button</a>
Thanks
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.
This is a fairly common question so I’ll refer you to a quality article on quirksmode.org that answers this question and other question you may have about event handling.
Here is an excerpt:
Have fun reading.