GingerSquirrel
4/19/2016 - 8:15 AM

Javascript code to enable a html video to be paused/played on click

Javascript code to enable a html video to be paused/played on click

<video id="vid_1142" class="videosize_" poster="preview.png" controls="" onclick="playPause('vid_1142');">
	<source src="/video/URL4" type="video/mp4">
	Your browser does not support the video tag.
</video>

<script>
function playPause(idtag){ 
	var myVideo=document.getElementById(idtag); 
	if (myVideo.paused) 
	  myVideo.play(); 
	else 
	  myVideo.pause(); 
	} 
</script>