Search
 
SCRIPT & CODE EXAMPLE
 

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>
Comment

JS Show/hide when button is clicked

var toggle  = document.getElementById("toggle");
var content = document.getElementById("content");

toggle.addEventListener("click", function() {
  content.classList.toggle("show");
});
Comment

PREVIOUS NEXT
Code Example
Html :: how to add video in html background 
Html :: bootstrap position fixed 
Html :: how to insert images into html 
Html :: html color pink 
Html :: integer input html 
Html :: href add delay 
Html :: how to make text big on big screens and smaller and smaller screen html 
Html :: call year in html 
Html :: disable overscroll html 
Html :: csrf token html form 
Html :: automatically refresh a web page 
Html :: if angular 
Html :: html button send post request 
Html :: js html textbox on change 
Html :: display html input datetime-local value from mysql 
Html :: navbar bootstrap 
Html :: html samp 
Html :: ngForm 
Html :: svg rounded corners 
Html :: how to add telephone number in html 
Html :: vertical tab bootstrap 
Html :: tailwind css float right 
Html :: path width svg change 
Html :: youtube embed autoplay not working 
Html :: bind script html 
Html :: how to add horizontal scroll bar in html 
Html :: image html 
Html :: bootstrap hamburger menu 
Html :: add subject to email link 
Html :: nuxt-lazy-load ignore images 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =