12

Is there a way to determine what Javascript function is called when you click on an item in a HTML page that has JS binded to the click event (added using jQuery, not the onClick tag attribute) ?

Obviously, the website is not mine and the code is minified.

1

1 Answer 1

27

This is available in all major browsers in the developer tools (usually press F12 to open).

In Chrome, for example, right click on the element, inspect element.

Then expand the 'Event Listeners' tab on the righthand side, find 'click' and expand that. It should give you a list of all potential listeners on the click event, including ones that would catch from bubbling up and a link to the function and its position in the file.

It can admittedly take a bit of hunting. If the code is minified most developer tools can expand it for you (e.g. the 'pretty print' option in webkit browsers like Chrome or tools 'Format javascript' in IE) or use an external tool, e.g. http://jsbeautifier.org/.

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

if you cant see the listeners, press Esc on Chrome or click the 3 dot menu and "open console drawer"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.