× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Avoid multiple event bindings

Tommy Williams
Feb 26, 2015
<p>Sometimes we have multiple event bindings on elements that we don't expect. Chrome dev tools can show you the event bindings on every element, but it doesn't do a great job. Get the chrome extension 'Visual Element' to show every binding on the page, and allows you to focus on the element to see the actual callback functions associated with it.</p> <p> </p> <p>Also, just because you remove a class or ID from the element that you have binded a listener to, doesn't mean the event binding goes away. Using jQuery, one should use $element.off('click') to remove event handlers from the element as well.</p>
comments powered by Disqus