I have something like that:
<div onclick="doSomething('foo', 'bar');"></div>
As you can see, the event isn’t passed to the handler. Is it somehow possible to access it inside the handler anyway?
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.
No.
The best way to accomplish this is to add an id to your div, and set up the event handling from a script.
This should do what you’re looking for
And then
Just make sure the script tags that contain the above are at the bottom of you body tag, so the script doesn’t run until the dom is created and ready.