Audio controls attribute
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:
- Play
- Pause
- Progress bar
- Volume
Note:
Browser support





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.
|
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