Why e.repeat is not working and have no errors in the console?
Answers (1)
Add AnswerIt looks like the repeat
property isn’t defined at all in the jQuery event (e
) object.
$(document).on("keydown keypress", function (e) { console.log(e.repeat); });
But using addEventListener
, it works with keydown
. You will notice that the very first log is false
and all the other ones are true
.
document.addEventListener("keydown", function(e){ console.log(e.repeat); // If pressed more then once (in less then 1000ms) "true" });