THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML

Audio controls Property

Audio Object Reference Audio Object

Example

Enable controls for an audio:

document.getElementById("myAudio").controls = true;
Try it Yourself »

Definition and Usage

The controls property sets or returns whether a audio should display standard audio controls.

This property reflects the <audio> controls attribute.

When present, it specifies that the audio controls should be displayed.

Audio controls should include:

  • Play
  • Pause
  • Seeking
  • Volume

Note: The <audio> element is new in HTML5.


Browser Support

Property
controls Yes Yes Yes Yes Yes

Syntax

Return the controls property:

audioObject.controls

Set the controls property:

audioObject.controls=true|false

Property Values

Value Description
true|false Specifies whether a audio should have controls displayed, or not
  • true - Indicates that controls are displayed
  • false - Default. Indicates that controls are NOT displayed

Technical Details

Return Value: A Boolean, returns true if audio controls are displayed, otherwise it returns false
Default Value: false 

More Examples

Example

Find out if the audio controls are displayed:

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

The result of x will be:

true
Try it Yourself »

Related Pages

HTML reference: HTML <audio> controls attribute


Audio Object Reference Audio Object