showPopover()
Shows a popover.
Published on • Updated on
The showPopover()
instance method of the Element
interface shows a popover element.
Syntax
showPopover()
Parameters
None.
Return value
Void.
Exceptions
NotSupportedError
DOMException
- Thrown if
showPopOver()
is called on an element that does not have a valid value of thepopover
attribute set on it. InvalidStateError
DOMException
- Thrown if
showPopOver()
is called on a valid popover that is already shown. InvalidStateError
DOMException
- Thrown if
showPopOver()
is called on a valid popover that is not connected to a document.
Example
const popover = document.getElementById('my-popover');
popover.showPopOver();
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