hide div on button click javascript
<style>
function hideDiv(){
var closedDiv = document.getElementById("closableDiv");
closedDiv.style.display = "none";
}
</style>
<button id="closableDiv" onClick="hideDiv()"> </button>
hide div on button click javascript
<style>
function hideDiv(){
var closedDiv = document.getElementById("closableDiv");
closedDiv.style.display = "none";
}
</style>
<button id="closableDiv" onClick="hideDiv()"> </button>
onclick hide div javascript
<script type="text/javascript">
function hide(id) {
document.getElementById(id).style.display = "none";
}
function show(id) {
document.getElementById(id).style.display = "";
}
</script>
<div id="div" onclick="hide('div')">
<p>Click to hide!</p>
</div>
javascript hide show div
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#hide").click(function(){
$("#1").hide();
$("#2").show();
});
$("#show").click(function(){
$("#1").show();
$("#2").hide();
});
});
</script>
</head>
<body>
<p id="1">Area 1</p>
<p id="2" style="display: none;">Second area</p>
<button id="show">Area 1</button>
<button id="hide">Second Area</button>
</body>
</html>
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