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

370
Vistas
innerHTML error in syntax not working; Uncaught TypeError: Cannot set properties of null (setting 'innerHTML')

For some reason I am keep on getting a syntax error from this "innerHTML", can someone help me?

HTML CODE:

<div id="ID"></div>

JavaScript CODE:

document.getElementById("ID").innerHTML = "Test";

Syntax Error: Uncaught TypeError: Cannot set properties of null (setting 'innerHTML')

I am trying to make the div respond with a "Test" using "innerHTML" and "getElementById" but the syntax error is getting in the way.

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

The error means that js not found with the selector ID. You need ID as a selector. Take a look:

document.getElementById("ID").innerHTML = "Test";
<div id="ID">Hello</div>

about 4 years ago · Juan Pablo Isaza Denunciar

0

The error refers to the fact that document.getElementById("ID") is invalid. Meaning that "ID" is not existing. In your HTML code there needs to be an object with the id="ID".

about 4 years ago · Juan Pablo Isaza Denunciar

0

Running getElementById on an ID that isn't currently existing on the webpage will give you this error, if you are working on a project with multiple scenes and you try to call this for an element on a scene that is NOT currently shown on the screen it will error out with this error.

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