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

91
Views
how to change overflow and height programmatically

I have the below div element. I want to be able to change the height and overflow attributes programmatically. I tried to change the height as shown below but it does not change.

Please let me know how to change the height and overflow programmatically.

TypeScript/JavaScript:

document.getElementById('select-layer-overlay').style.height = '200px'

HTML/Angular

<div id="select-layer-overlay" style="height: 360px;overflow: auto;" *ngIf="showSelectLayers && selectedSite!=null">
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I checked the same and it is working for me, but since you are using the Angular, it is not preferable to update DOM by directly referring the elements like this, instead you can provide a class name and based on that you can toggle the height and overflow properties.

var btn = document.getElementById('btn');

btn.addEventListener('click', function() {
  document.getElementById('select-layer-overlay').style.height = '200px';
})
#select-layer-overlay {
  border: 1px solid #ddd;
}
<div id="select-layer-overlay" style="height: 300px;overflow: auto;" >Hello</div>

<button id="btn">Click</button>

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!