DOM Interfaces

HTMLAudioElement

Represents audio playback and inherits the media element's loading, timing and control APIs. Audio may also be created using new Audio(); playback still depends on resource availability and autoplay policy. Example result: true.

Formal Syntax & Structure

html syntaxhtml
const element = document.getElementById('demo'); // HTMLAudioElement

Return Value

HTMLAudioElement

An existing HTML DOM object associated with the audio element in this example; this interface is a type, not a function return contract.

Working Example

Example Snippethtml
<audio id="demo" controls></audio><p>  Result:  <output id="result"></output></p><script>  const e = document.getElementById('demo');  const result = value => { document.getElementById("result").textContent = String(value); };  result(e.controls);</script>
HTML Reference