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

219
Vistas
JS variables and css properties

If I put a css property in JS variable, and change the variable value, does the property change?

And a little subquestion: what's difference between let and var, and what should I use?

For example:

    let property = document.getElementById("el").style.display;
//  variable's content changed
    property = "block";
//  will the #el's display property change?
    
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

    let property = document.getElementById("el").style.display;
//  variable's content changed
    property = "block";
//  will the #el's display property change?
    

No . What is changing is the Javascript variable called property. First of all it takes on the value of the style.display of the element #el and then it is given the value of another string which is 'block'

It is possible to set a property of el but on the 'left hand side' you need to tell JS that is what you want it to do:

document.getElementById("el").style.display = "block";
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