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

155
Views
How to disappear/appear content in html?

I want to appear/disappear a <div> in a html file from a javascript function. How can I do that?

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

0

Here's a real simple way.

function togglehide(id){

    var el = document.getElementById(id);
  el.classList.toggle('hideme');
  
}
.hideme{display:none}
<button onclick="togglehide('mydiv')">Click me</button>
<br>
<div id="mydiv">
put some content here
</div>

about 4 years ago · Juan Pablo Isaza Report

0

Select it, then set either its style, or add a CSS class that does the hiding.

document.querySelector("#element-id").classList.toggle("d-none");
about 4 years ago · Juan Pablo Isaza Report

0

let div = document.querySelector('div');
div.style.display = 'none'; // this will make it as if it didn't exist
div.style.opacity = 0 // this will make it transparent
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!