The keydown event can be attached to any element
but the event is only sent to form elements
If you'd like to remove specific handler that registered keydown event
you can use namespace such as ".myPlugin"
- http://api.jquery.com/off
but the event is only sent to form elements
If you'd like to remove specific handler that registered keydown event
you can use namespace such as ".myPlugin"
let moveToPrevItem = (e) => {
if(e.shiftKey && e.which === 37){
this._movePrev();
e.preventDefault();
return false;
}
};
let moveToNextItem = (e) => {
if((e.ctrlKey || e.shiftKey) && e.which === 39){
this._moveNext();
e.preventDefault();
return false;
}
};
$(document).off('keydown.toPrevItem');
$(document).on('keydown.toPrevItem', keyDownToPrevItem);
$(document).off('keydown.toNextItem');
$(document).on('keydown.toNextItem', keyDownToNextItem);
- http://api.jquery.com/off
댓글
댓글 쓰기