Please use the code
It can helps you to prevent immediate twice execution of the event
$(document).keydown(function (e) {
e.stopImmediatePropagation();
......
......
Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree.