Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

223
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda