Say you have this div:
<div id="foo">bar</div>
And you do this:
$("#foo").click(someFunction);
somewhere inside your Javascript code.
Once the page has been loaded, is there a way to find out, via firebug or inspect element in Chrome, or anything else, that the click event for #foo
is bound to someFunction
? I.e., find this out without having to look through all your code?
Right-click on the search icon button and choose “inspect” to open the Chrome developer tools. Once the dev tools are open, switch to the “Event Listeners” tab and you will see all the event listeners bound to the element. You can expand any event listener by clicking the right-pointing arrowhead.
JavaScript Event HandlersEvent handlers can be used to handle and verify user input, user actions, and browser actions: Things that should be done every time a page loads. Things that should be done when the page is closed. Action that should be performed when a user clicks a button.
Open Google Chrome and press F12 to open Dev Tools. Go to Event Listener Breakpoints, on the right: Click on the events and interact with the target element.
This event handler invokes a JavaScript code when we place the mouse over a specific link or an object. This event handler invokes a JavaScript code when the mouse leaves a particular link or an object.
Chrome Developer tools does this.
This will give you a list of event listeners on the object that can be expanded to find their source and the attached function.
Firebug has this information under the DOM tab, but it's less user friendly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With