Audio controls attribute

Definition and usage

controls Attribute settings or returns whether standard audio controls should be displayed.

This attribute reflects <audio> controls attribute.

If it exists, it specifies that audio controls should be displayed.

The audio controls should include:

  • Play
  • Pause
  • Search
  • Volume

Example

Example 1

Enable audio controls:

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

Try it yourself

Example 2

Check if the audio controls are displayed:

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

Try it yourself

Syntax

Return the controls attribute:

audioObject.controls

Set the controls attribute:

audioObject.controls = true|false

Attribute value

Value Description
true|false

Specifies whether controls should be displayed for audio

  • true - Indicates that controls are displayed
  • false - Default. Indicates that controls are not displayed

Technical Details

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

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Related Pages

HTML Reference Manual:HTML <audio> controls Attribute