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

137
Vistas
GetElementById Returns Null Even Though Its Formatted Correctly

I have an html file whos body looks like this:

<body>
<header>
    <h1></h1>
</header>
<main>
    <div id="menu">
        <div>
            <div></div>
            <div></div>
            <div></div>
        </div>
    </div>
</main>
<footer>
    <p></p>
</footer>

<script src="js/script.js"></script>

</body>

the linked js file has this near the beginning:

var received = document.getElementById("menu");

the script is included at the bottom of the page and ive even tried windows onload, but no matter what, the javascript debugger shows "received" being null after attempting to get the element.

This looks like a repost but from what I can tell, I already formatted it correctly and implemented most popular fixes before looking for help.

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