Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

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>
 
PREVIOUS NEXT
Tagged: #onclick #hide #div #javascript
ADD COMMENT
Topic
Name
8+6 =