html hide a div by default
<div class="toshow" style="display:none"></div>
html hide a div by default
<div class="toshow" style="display:none"></div>
onclick show div and hide other div
<div id="div1">A DIV element...</div>
<div id="div2">Another DIV element</div>
<div id="div3" hidden>A hidden DIV element</div>
<button id="switch">Click to hide visible DIVs and show hidden ones</button>
<script type="text/javascript">
const div1 = document.getElementById("div1"),
div2 = document.getElementById("div2"),
div3 = document.getElementById("div3");
document.getElementById("switch").addEventListener("click", function() {
// hide element: element.hidden = true;
// show element: element.hidden = false;
div1.hidden = !div1.hidden;
div2.hidden = !div2.hidden;
div3.hidden = !div3.hidden;
});
</script>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us