function showStuff(id, text, btn) {
document.getElementById(id).style.display = 'block';
// hide the lorem ipsum text
document.getElementById(text).style.display = 'none';
// hide the link
btn.style.display = 'none';
}
// Hide div :
document.getElementById(div_id).style.display = none;
/// Show div :
document.getElementById(div_id).style.display = block;
//hidden attribute
document.getElementById("the-element-id").hidden=true
document.getElementById("the-element-id").setAttribute("hidden",true)
//style attribute
document.getElementById("the-element-id").style.display="none"
//If you have jquery, you can use the following method:
$("#mydiv").hide(); //hides div.
$("#mydiv").show(); //shows div.
//If you don't have jquery...
//search up the following: html how to add jquery
Check this! https://dev.to/devlorenzo/js-hide-and-show-32og
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
</head>
<body>
<div id="box" style="background-color: salmon; width: 100px; height: 100px">
Box 1
</div>
<button id="btn">Hide div</button>
<script src="index.js"></script>
</body>
</html>
hide and show divs using javascript