DOM Interfaces

HTMLProgressElement

Represents task completion with a value, maximum and normalized position. Omitting value makes progress indeterminate; position is then -1. Use meter for a scalar measurement instead. Example result: 0.5.

Formal Syntax & Structure

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

Return Value

HTMLProgressElement

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

Working Example

Example Snippethtml
<progress id="demo" value="2" max="4">2 of 4</progress><p>  Result:  <output id="result"></output></p><script>  const e = document.getElementById('demo');  const result = value => { document.getElementById("result").textContent = String(value); };  result(e.position);</script>
HTML Reference