Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!