Favorites

DOM HTMLElement.hidden Property

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
HTMLElement.hidden
DOM HTMLElement PropertyThis property is supported by all modern browsers.
Updated 28th November 2026

The hidden property shows or hides an element by setting its hidden attribute.

Description

The hidden property reflects the element's hidden attribute. Setting it to true hides the element from everyone, including screen readers; false shows it. The value "until-found" keeps content hidden but lets the browser's find-in-page reveal it.

A CSS rule that sets display on the element can override the attribute, so add [hidden] { display: none !important; } if your styles might conflict.

Hidden elements aren't rendered and are removed from the accessibility tree, so screen readers ignore them too. To hide something visually while keeping it available to screen readers, use a "visually hidden" CSS class instead.

Syntax

element.hidden
element.hidden = true | false | "until-found"

Value

true if the element is hidden, false if not, or "until-found".

Example

<button id="btn" type="button" aria-expanded="false">Toggle details</button>
<div id="panel" hidden>Here are the details.</div>
const btn = document.getElementById('btn');
const panel = document.getElementById('panel');
btn.addEventListener('click', () => {
  panel.hidden = !panel.hidden;
  btn.setAttribute('aria-expanded', !panel.hidden);
  console.log('hidden:', panel.hidden);
});
btn.click();

Browser Support

The following information will show you the current browser support for the HTMLElement.hidden property. Hover over a browser icon to see the version that first introduced support for this property.

This property is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee