// Hide div :
document.getElementById(div_id).style.display = none;
/// Show div :
document.getElementById(div_id).style.display = block;
//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