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

291
Visualizações
Is It Possible to Create the Effect of Virtually Pressing a Keyboard Key When a Web Page Is Loaded?

Is it possible to automatically create the effect of pressing a key from the keyboard while the WEB page is loading?

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test Application</title>
</head>

<body>

    <br><br>
    <center>
        <h1>Press Any Key</h1>
    </center>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"> </script>
    
    <script type="text/javascript">
        $(document).keypress(function(event){
            var key = (event.keyCode ? event.keyCode : event.which);
            var ch=String.fromCharCode(key);
            
            alert('You pressed key : ' +ch);  
            
            $("inputSelector").trigger($.Event("keypress", { keyCode: 90 }));
        });
    </script>
</body>
</html>
about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

You need an EventListener.

Try this:

document.addEventListener('keypress', logKey);

function logKey(e) {
  alert( `You pressed key: ${e.code}`);
}
about 4 years ago · Santiago Gelvez 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