JSFiddle - React, Tailwind, and code Playground

by aflynt

HTML

<video id="myvideo">
    <source src="path/to/movie.mp4" />
</video>

<p onclick="toggleControls();">Toggle</p>

JavaScript

var video = document.getElementById("myvideo");

function toggleControls() {
  if (video.hasAttribute("controls")) {
     video.removeAttribute("controls")   
  } else {
     video.setAttribute("controls","controls")   
  }
}