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

93
Vistas
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 Respuestas
Responde la pregunta

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 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