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

HTML DOM Audio controls attribute

Audio controls attribute

Audio Object Reference Audio object

Example

Enable controls for the audio:

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

Try it »


Definition and Usage

The controls attribute sets or returns whether the browser should display standard audio/video controls.

This property reflects

If the attribute is present, it specifies how the audio controls are displayed.

Audio/video controls include:

Note:


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the controls attribute.

Note: Internet Explorer 8 or earlier browsers do not support it


Syntax

Return the controls attribute:

audioObject

.controls

Set the controls attribute:

audioObject

.controls=true|false

Attribute values

Value Description
true|false Specifies whether the audio displays controls.
  • true - specifies that controls are displayed.
  • false - default. Specifies that controls are not displayed.
  • |

    Technical Details

    Return Value: Boolean. Returns true if the audio is set to display controls, otherwise false.
    Default value: false 

    More examples

    Example

    Check whether the audio controls are displayed:

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

    x

    The output is:

    true

    Try it »


    Related Articles

    HTML Reference Manual: HTML


    Audio Object Reference Audio object