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

133
Views
Div id css code only working if place it underneath or next to it

I'm trying to display the div tag when the checkbox is checked. Everything is working, but when I move tag down about a few lines, it stops working. If I put the tab next to the input tag then it works fine.

css

#toggle-content-box{
display:none;
}
#mycheckbox:checked ~ #toggle-content-box{
 display:block;
height:100px;

}

If I place the div underneath the line then it works perfectly.

 <input type="checkbox"  name="file_id"  id="mycheckbox" value="">
 <div id="toggle-content-box">This div will display when checkbox above is checked</div>

But for some reason, I need to move this div down about 10 lines from the line, then it stops working. The div is not showing when the checkbox is checked.

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

0

You should declar the checkbox before the div not after it !

This is why when you put the div above the checkbox it is not working.

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!