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

223
Vistas
How does using variables in javascript work?

I have some simple code here, and I want to test it out, by making the display none, is there something wrong with my javascript? (I'm very new to js)

 var meter = document.getElementById("meter").innerHTML;
        meter.style.display = "none";
<meter id="meter" min="0" max="10"></meter>

The console says meter is undefined, but I defined it right above.

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

0

meter is the innerHTML of the element (which is a string), not the element itself.

Instead, use:

var meter = document.getElementById("meter");
meter.style.display = "none";
<meter id="meter" min="0" max="10"></meter>

If you want to hide it and get its value, you can do:

var meter = document.getElementById("meter");
meter.style.display = "none";
var val = meter.value;
console.log(val)
<meter id="meter" min="0" max="10" value="3"></meter>

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