hidePopover()
Dismisses a popover.
Published on • Updated on
The hidePopover()
instance method of the Element
interface dismisses a popover element.
Syntax
hidePopover()
Parameters
None.
Return value
Void.
Exceptions
NotSupportedError
DOMException
- Thrown if
hidePopover()
is called on an element that does not have a valid value of thepopover
attribute set on it. InvalidStateError
DOMException
- Thrown if
hidePopover()
is called on a valid popover that is not currently showing.
Example
const popover = document.getElementById('my-popover');
popover.showPopOver(); // needs to be shown first
...
popover.hidePopover();
Browser compatibility
- The Popover API is planned for launch in Chrome 110, available in stable in early February 2023 (check the Chrome Roadmap for updates).
- It is enabled by default in Chrome Canary for local testing.
- Register for the Origin Trial if you want to test it in a production environment. Read Getting started with Chrome's origin trials for more information.
- There is a polyfill available at https://github.com/oddbird/popup-polyfill.
See also
Updated on • Improve article