Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Video controls Property

Video controls property

Video Object Reference The Video object

Example

Enable video controls:

document.getElementById("myVideo").controls=true;

Try it »


Definition and Usage

The controls property sets or returns whether the browser should display the standard video controls.

This property reflects

When this property is used, it specifies displaying the video controls.

The video controls include:

Note:


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the controls property

Note: Internet Explorer 8 and earlier IE versions are not supported.


Syntax

Return the controls attribute:

videoObject

.controls

Set the controls attribute:

videoObject

.controls=true|false

Attribute values

Value Description
true|false Describes whether to display the video controls:
  • true - Specifies displaying the controls
  • false - Default. Specifies not displaying the controls
  • |

    Technical Details

    Return Value: Boolean, returns true if the video controls are displayed, otherwise returns false.
    Default value: false 

    More examples

    Example

    Check whether the video controls are displayed:

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

    x

    The output is:

    true

    Try it »

    Example

    Enable, disable, and detect the control state:

    var

    x

    =

    document

    .

    getElementById

    (

    "

    myVideo

    "

    )

    ;

    function

    enableControls

    (

    )

    {

    x

    .

    controls

    =

    true

    ;

    x

    .

    load

    (

    )

    ;

    }

    function

    disableControls

    (

    )

    {

    x

    .

    controls

    =

    false

    ;

    x

    .

    load

    (

    )

    ;

    }

    function

    checkControls

    (

    )

    {

    alert

    (

    x

    .

    controls

    )

    ;

    }

    Try it »


    Related pages

    HTML Reference Manual: HTML


    Video Object Reference The Video object