Video controls Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Video


The controls property sets or gets whether a video should display standard video controls.

This property reflects the <video> controls attribute.

Set the controls property with the following Values

Value Description
true|false Sets whether a video should have controls displayed

Return Value

A Boolean, returns true if video controls are displayed, otherwise it returns false

Default Value is false

The following code shows how to Enable controls for a video:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<video id="myVideo" width="320" height="240">
  <source src="your.mp4" type="video/mp4">
  <source src="your.ogg" type="video/ogg">
  Your browser does not support the video tag.

<button onclick="enableControls()" type="button">Enable controls</button>
<button onclick="disableControls()" type="button">Disable controls</button>
<button onclick="checkControls()" type="button">Check controls status</button>

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

function enableControls() {//from w  w  w.j av a 2 s .co  m
    x.controls = true;

function disableControls() {
    x.controls = false;

function checkControls() {


Related Tutorials