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

151
Vistas
Uncaught TypeError: Cannot set properties of null (setting 'onclick')

Right now i am having this issue that i just can't seem to fix and the only better place than to look for how to fix this is stack overflow so here is the code HTML:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="description" content="Hallo this is a game" />
<link rel="icon" href="images/SpongeBob_SquarePants_character.svg.png" />
<script src="index.js"></script>
<title>Javascript Game</title>
</head>

<body>
<script src="index.js"></script>
<label for="averynicebutton">Button</label>
<input type="checkbox" id="averynicebutton" /> <br />
<button id="submitButton">Submit</button>
</body>
</html>

again very simple code heres the javascript:

document.getElementById("averynicebutton").onclick = function(){
  
if(document.getElementById("averynicebutton").checked){
    console.log("you clicked a button Woo-Hoo!")
  }
}

Also heres a image for reference

so if you know how this problem occurred please tell me as i am very puzzled on how this happened as i am very new to javascript. Thank you for taking the time to read this. Bye Bye

about 4 years ago · Juan Pablo Isaza
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