This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The max property of the HTMLProgressElement interface represents the upper bound of the <progress> element's range.
A floating point number that is greater than zero. The default value is 1.0.
Progress: <progress id="pBar"></progress> <span>0</span>%
const pBar = document.getElementById("pBar");
const span = document.getElementsByTagName("span")[0];
console.log(`Default value of max: ${pBar.max}`);
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);
| Specification |
|---|
| HTML> # dom-progress-max> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
max |
6 | 12 | 6 | ≤12.1 | 6 | 18 | 6 | ≤12.1 | 6 | 1.0 | 4.4 | 6 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLProgressElement/max