Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

99
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda