I want to disable the keydown event to happen, until the script inside the keydown event finish execution.
$(document).keydown(function(e){
if (e.keyCode == 40){
down(); //Assume down has some animate function executes for 1sec
}
});
Currently, when I press down key and keep it without releasing, keydown event fires repeatedly, I want to disable that.
Solution based on Asad’s answer: