Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

210
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda