Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
What is causing a one keypress delay?

When I type something it gets delayed by one keypress. for example if I type h, it would be blank, if i type helloworld it would be helloworl. If I have sad displayed, I would have to press backspace twice to get to sa instead of once. Why is there this delay? How do I fix it?

<input type="text" id = "new"></input>
<p id = "result"></p>
<script src = "script.js" type = "module"></script>
var search = document.getElementById("new");
var resultbox = document.getElementById("result");
search.addEventListener("keydown", function(){
  resultbox.innerHTML = search.value;
})
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

keydown or keypress is execed before the new character is added to the value of the element.

you can use input or keyup event.

search.addEventListener("input", function(){
  resultbox.innerHTML = search.value;
})
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!