Progress: <progress id="pBar"></progress> <span>0</span>%HTMLProgressElement: max property / notebook
HTMLProgressElement: max property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
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);