Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

onclick video popup in html codepen

//html
<div id="button"></div>
<div id="video" style="display:none;>
  <video width="200" height="150" controls>
	<source src="vid.mp4" type="video/mp4">
</div>

//javascript
document.getElementById('button').addEventListner('click', function(){
	let video = document.getElementById('video');
  
  	function showVideo(){
    video.style.display = "block";
    }
  
  	function hideVideo(){
    video.style.display = "none"
    }
  
  showVideo();
  hideVideo();
}
 
PREVIOUS NEXT
Tagged: #onclick #video #popup #html #codepen
ADD COMMENT
Topic
Name
3+4 =