A hidden attribute on a <progress> tag hides the progress element.
Although the progress element is not visible, its position on the page is maintained.
A hidden attribute on a <progress> tag.
The progress control is not visible.
A hidden progress element:
<p>A hidden progress element:</p>
<progress value="50" max="100" hidden> 50% </progress>
The hidden attribute hides the <progress> element.
You can specify either 'hidden' (without value) or 'hidden="hidden"'. Both are valid.
A hidden <progress> element is not visible, but it maintains its position on the page.
Removing the hidden attribute makes it re-appear.
<progress hidden>
<progress hidden="hidden">
Value | Description |
---|---|
hidden | Use 'hidden' or hidden='hidden'. Both are valid. |
Clicking the button toggles A hidden attribute on the <progress> element.
<div>Loading files... </div>
<br />
<progress id="myprogress" value="40" max="100"> 40% </progress>
<br />
<button onclick="toggle(this)">Hide progress</button>
<script>
let toggle = button => {
let element = document.getElementById("myprogress");
let hidden = element.getAttribute("hidden");
if (hidden) {
element.removeAttribute("hidden");
button.innerText = "Hide progress";
} else {
element.setAttribute("hidden", "hidden");
button.innerText = "Show progress";
}
}
</script>
Initially, the <progress> control is visible.
Clicking the button calls JavaScript which toggles the hidden attribute.
With the hidden attribute the progress control is invisible.
Here is when hidden support started for each browser:
Chrome
|
8.0 | Dec 2010 |
Firefox
|
16.0 | Oct 2012 |
IE/Edge
|
10.0 | Sep 2012 |
Opera
|
11.0 | Dec 2010 |
Safari
|
6.0 | Jul 2012 |
Back to <progress>