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

296
Visualizações
keyCode not working, geting scratch on keyCode on using document.onkeyup or onkeydown, scratch will go when i use document.onclick, but i want onkeyup
document.onkeyup = function(e){
console.log("Key code is:",e.keyCode)
if(e.keyCode == 38){
    dino=document.querySelector('.dino');
    dino.classList.add('animateDino');
    setTimeout(()=>{
        dino.classList.remove('amimateDino')
    },700);
  }
}

I'm doing a popular dino game tutorial from a youtube channel called code with harry, I'm struck with the initial stage itself
Image 1:this is my image with onkeyup Image 2:this is my image with onclick Image3: this is the image from where I'm learning:#CodeWithHarry here the code is showing normal but in my vs code(please open the above-linked photos to understand my problem), I'm getting a scratch on keyCode that scratch will go once if I use onclick or without anything that will be normal.

about 4 years ago · Santiago Trujillo
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