Using the Chrome developer tool, how can I view the script that will be run when I click a button on a web page? Is it possible, or will I have to use some special tools?
Share
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.
Chrome, do a right-click -> inspect element on the element (in this case the button) that you want to view event handlers for. On the right (next to the HTML) you should see a window with some CSS. If you scroll all the way down, there is an “event listeners” section. Expand it and you can view handlers for the various events.
Note that I have not always found this useful; it does not always show all of the handlers that are sniffing your element. It does do what you are looking for, but sometimes it’s best to just write to console (
console.log()) in your code to find out what handlers are being called.Let me know if you have any questions on this. Good luck! 🙂