Answers for "how to hide div using html"

CSS
4

hide a div

<div id="main"> 
  <p> Hide/show this div </p>
</div>

('#main').hide(); //to hide

// 2nd way, by injecting css using jquery
$("#main").css("display", "none");
Posted by: Guest on July-17-2020
2

html hide element

document.getElementById('elementId').style.display = "none";
Posted by: Guest on February-14-2022
2

how hide in html

#elementID{
display:none;
}
Posted by: Guest on December-19-2020
9

how to hide div in html

document.getElementById('elementName').hide();
Posted by: Guest on November-09-2019
0

hide a div

const targetDiv = document.getElementById("third");
const btn = document.getElementById("toggle");
btn.onclick = function () {
  if (targetDiv.style.display !== "none") {
    targetDiv.style.display = "none";
  } else {
    targetDiv.style.display = "block";
  }
};
Posted by: Guest on December-24-2021

Browse Popular Code Answers by Language