Вопрос

I'm working on a site with lots of third party js that I don't have much say in what gets loaded. I'm trying to troubleshoot a particular issue and would like to remove all click and mouseup events. Currently (for whatever reason) when you click anywhere in the page (in the margins and blank areas), the element inspector timeline registers 3 clicks and 1 mouseup event. The mouseup and 2 clicks are being caught by jquery, with the remaining click being caught by some other 3rd party js. In the console, if I put in: jQuery('html *').unbind(); this gets rid of one of the click events. Putting jQuery('html *').off(); in the console, doesn't appear to get rid of any of the click or mouseup events. I'm just trying various 'nuke' options for the sake of troubleshooting. Thanks!

Это было полезно?

Решение 2

Found the thing that did the trick $(document).add('*').off(); Though am not sure why adding back existing nodes to the DOM is more effective than altering the ones in place.

Другие советы

Read .off()

Syntax

.off( events [, selector ] [, handler(eventObject) ] )

Description: Remove an event handler.

jQuery('html *').off('click');

Read .unbind()

This signature does not accept any arguments.

jQuery('html *').unbind();
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top