Javascript DOM HTML Video controls Property get

Introduction

Find out if the video controls are displayed:

var x = document.getElementById("myVideo").controls;

Click the button to find out if the video controls are displayed.

View in separate window

<!DOCTYPE html>
<html>
<body>

<video id="myVideo" width="100" height="100" controls>
  <source src="video.mp4" type="video/mp4">
  <source src="video.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>//  w  w w.  j  ava  2  s.com
<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
  var x = document.getElementById("myVideo").controls;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related