HTMLProgressElement: value property
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The value
property of the HTMLProgressElement
interface represents the current progress of the <progress>
element.
Value
A floating point number. If max
value is not set on the progress bar then value ranges between 0.0 and 1.0. If the max
value is set then the value
ranges between 0
and the max
value.
If the value
property is not set on HTMLProgressElement
object, then the progress bar remains indeterminate.
Examples
HTML
html
Determinate Progress bar: <progress id="pBar"></progress> <span>0</span>%
<br />
Indeterminate Progress bar: <progress></progress>
JavaScript
js
const pBar = document.getElementById("pBar");
const span = document.getElementsByTagName("span")[0];
pBar.max = 100;
pBar.value = 0;
setInterval(() => {
pBar.value = pBar.value < pBar.max ? pBar.value + 1 : 0;
span.textContent = Math.trunc(pBar.position * 100);
}, 100);
Specifications
Specification |
---|
HTML # dom-progress-value |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
value |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.