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

348
Views
Selector de hermanos general de dirección CSS y entrada: marcado

He intentado abordar estilos definidos así:

 entrada de encabezado [tipo = casilla de verificación] ~ div # ejemplo {max-height: 0px;}
 entrada de encabezado [tipo = casilla de verificación]: marcado ~ div # ejemplo {max-height: 100px;}

me gustaría hacer algo como

 document.getElementById('ejemplo').style.maxHeight='10px';
pero solo debe cambiar
 entrada [tipo = casilla de verificación]: marcado
no la versión sin marcar.

¿Tal vez hay una manera con nextElementSibling? ¡Gracias por tu ayuda!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede restablecer maxWidth cuando la entrada cambia de no marcada a marcada y vv.

 document.querySelector('header input[type=checkbox]').addEventListener('change', function(event) { document.getElementById('example').style.maxHeight = event.target.checked ? '10px' : '0px'; });
 header input[type=checkbox]~div#example { max-height: 0px; } header input[type=checkbox]:checked~div#example { max-height: 100px; }
 <header> <input type="checkbox"> <div id="example"></div> </header>

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!