Why e.repeat is not working and have no errors in the console?

Forums jQueryWhy e.repeat is not working and have no errors in the console?
Staff asked 2 years ago

Answers (1)

Add Answer
Prince Dhameliya Marked As Accepted
Staff answered 2 years ago

It 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"
});

 

Subscribe

Select Categories