The event attach with enabled does not untie

I am loading a .html file using the jquery load() function. The html file I am loading

contains a few script, in that the script has a keydown event associated with the document,

like: $(document).on("keydown", handler); . Now in the load() callback I am

trying to untie keydown event , $(document).off("keydown"); but the event has not been canceled.

Can someone tell me what I am doing wrong?

+4
source share
4 answers

You can use bind and trigger to attach and fire events instead of on .

0
source

Try:

  $(document).unbind("keydown"); 
0
source

Try to cancel the event as follows:

 $('#foo').unbind(); 
-1
source

Try using this:

 $(document).off("keydown", "*"); 
-1
source

All Articles