Will the following log itself upon getting clicked in every browser?
<a href="#" onclick="console.log(this);">Click me!</a>
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.
Yes, for inline html attribute event handlers
thisis reliably the element in question.However your example with
console.log(this)will not work in every browser, because not all browsers have a console, and certain browsers with a console give an error unless the console is actually open when theconsole.log()statement executes.