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

209
Visualizações
My variable is crossed out in Visual Code

My editor (VS Code) shows that my variable is deprecated. The "event" variable is struck out, but in my prof's video, it isn't so I'm assuming something is wrong. Please help!

document.querySelector("#myCanvas").onclick = function(){
    console.log("click", event);
}

enter image description here

I called the variable in the function which fixed it, but now I'm trying to do "onkeydown" and nothing is happening when I refresh the HTML

document.querySelector("#myCanvas").onmousemove = function(event){

    // console.log(event.offsetX, event.offsetY);
    // console.log("click", event);
}


document.onkeydown = function(){
    console.log("keypress" ,event);
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The "global" event property (i.e., window.event) is deprecated. Why is it global here? Because you didn't pass the event returned by the onclick callback to your onclick event handler, like this:

document.querySelector("#myCanvas").onclick = function(event) {
    console.log("click", event);
}
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