HTML <meter> hidden Attribute

The hidden attribute on a <meter> tag hides the meter element. Althought the meter is not visible, it maintains its position on the page.

Example

#

A hidden attribute on a <meter> tag.
The meter element is not visible.

A hidden meter element:

<p>A hidden meter element:</dp>

<meter value="0.5" hidden>50%</meter>

Using hidden

The hidden attribute hides the <meter> element.

You can specify either 'hidden' (without value) or 'hidden="hidden"'. Both are valid.

A hidden <meter> element is not visible, but it maintains its position on the page.

Removing the hidden attribute makes it re-appear.


Syntax

<meter hidden>
or
<meter hidden="hidden">

Values

#

Value Description
hidden Use 'hidden' or hidden='hidden'. Both are valid.


More Examples

Clicking the button toggles the hidden attribute on the <meter> element.

Loading files...

50%

<div>Loading files...</div>

<br />
<meter id="mymeter" value="0.5">50%</meter>

<br /><br />
<button onclick="toggle(this)">Hide meter</button>

<script>
  let toggle = button => {
    let element = document.getElementById("mymeter");
    let hidden = element.getAttribute("hidden");
    
    if (hidden) {
       element.removeAttribute("hidden");
       button.innerText = "Hide meter";
    } else {
       element.setAttribute("hidden", "hidden");
       button.innerText = "Show meter";
    }
  }
</script>

Code explanation

Initially, the <meter> is visible and has no hidden attribute.

Clicking the button calls JavaScript which toggles the hidden attribute.

With the hidden attribute the <meter> is not visible.


Browser support

Here is when hidden support started for each browser:

Chrome
8.0 Dec 2010
Firefox
6.0 Aug 2011
IE/Edge
13.0 Nov 2015
Opera
11.0 Dec 2010
Safari
6.0 Jul 2012

You may also like

 Back to <meter>
Guides