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

253
Vistas
Is there a way to Hide/unhide all child elements of a DOM node in JavaScript?

Say I have the following HTML and I want to hide all the children of the 'overlay' div dynamically

<div id="overlay" class="foo">
    <h2 class="title">title</h2>
    <h1 id="bar">sub-title</h1>
    <button id="reset">reset</button>
</div>

is there a better way to mass hide/unhide these elements than calling .className = 'hide' on them individually?

*note that I want to retrieve those later so looping over them with .remove() or setting div innerHTML to an empty string is not an option

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In your css you can create this:

#overlay.hidden-content > * {
 visibility: hidden
}

And add hidden-content to your div with overlay id to hide all the child elements.

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