I am trying to remove the keydown event that I have created using the following code:
$(document).keydown(function(e) {
alert("Key Down");
});
when I am using the following code:
$(document).off('keydown');
it throws the following error:
Uncaught TypeError: Object [object Object] has no method 'off'
can someone point me to the correct way to un-register from the keydown event?
Unbind all
keydownhandlers fromdocument:Or to make sure you only unbind that specific handler:
http://api.jquery.com/unbind