Answers for "javascript hide element on click"

12

javascript hide div

// javascript
<script>
	document.getElementById("id").style.display = "none";  //hide
	document.getElementById("id").style.display = "block"; //show
	document.getElementById("id").style.display = ""; 	   //show
</script>

// html
<html>
	<div id="id" style="display:none">
    <div id="id" style="display:block">
</html>

// jquery
<script>
	$("#id").hide();      
	$("#id").show();
</script>
Posted by: Guest on May-18-2020
0

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>
Posted by: Guest on July-13-2021
0

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>
Posted by: Guest on July-16-2021

Code answers related to "javascript hide element on click"

Code answers related to "Javascript"

Browse Popular Code Answers by Language