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

98
Views
How to allow buttons to be pressed quickly on a website

I have set up a keyboard on my website where you can click on a key to type a letter. When i access the site on my phone and try to type a word, it misses out keys because it won't allow for buttons to be pressed that quickly.

Is there a way to allow this? an example would be in wordle: https://www.powerlanguage.co.uk/wordle/ where the buttons can be pressed in quick succession

my website uses react if that helps

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

In the case in which you cannot "move" the text cursor (as it happens in wordle), you could consider using this combination of event listeners, intervals and queue-like array structures:

HTML:

<div class="output"></div>
...
<button type="button" class="letter"> Q </button>
<button type="button" class="letter"> W </button>
<button type="button" class="letter"> E </button>
...
<button type="button" class="letter"> ← </button>

JS:

let word = [ ];

document.querySelectorAll(".letter").forEach(
    el => el.addEventListener("click", ev => {
        word.push(el.innerText.trim());
    })
);

setInterval(() => {
    if(word.length) {
        let char = word.shift();
        if(char == "←") document.querySelector(".output").innerText = document.querySelector(".output").innerText.slice(0, -1);
        else document.querySelector(".output").innerText += char;
    }
}, 50);
about 4 years ago · Juan Pablo Isaza Report

0

Ok, I figured out the issue. I was using divs with an "onClick" property. When i switched them to buttons the problem was gone.

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!