I have a few things like this...
$('body').on('keyup', function(e){if(e.which === 32){//do stuff}})
I need to disable some of these events at times but not all of them.
$('body').off('keyup') just turns them all off.
Namespace them...
$('body').on('keyup.some_name', function(e){if(e.which === 32){//do stuff}})
$('body').off('keyup.some_name')
var onKeyUp = function(e){if(e.which === 32){//do stuff}}
$('body').on('keyup', onKeyUp);
// later...
$('body').off('keyup', onKeyUp);
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