Answers for "how to show a div on button click in javascript"

2

onclick hide div javascript

<div id="div">
	<p>Click to hide!</p>
</div>
<script type="text/javascript">
	const div = document.getElementById("div");
	div.addEventListener("click", function() {
		// hide element: element.hidden = true;
		// show element: element.hidden = false;
		div.hidden = true;
	});
</script>
Posted by: Guest on July-16-2021
0

how to make a div appear when clicked on in javascript

function showDiv() {
  document.getElementById('sign-in').style.display = "block";
}
Posted by: Guest on August-13-2020

Code answers related to "how to show a div on button click in javascript"

Browse Popular Code Answers by Language