DOM Methods
HTMLElement.togglePopover()
Toggles popover visibility or requests a particular state. The return value indicates whether the popover is showing after the operation. The Boolean force argument requests show or hide. Newer options such as source have separate support considerations. Example result: true.
Formal Syntax & Structure
html syntaxhtml
element.togglePopover(forceOrOptions)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| forceOrOptions | boolean or object | Optional desired visibility or options containing force and source. |
Return Value
boolean
Toggles popover visibility or requests a particular state.
Working Example
Example Snippethtml
<div id="demo" popover>Note</div><p> Result: <output id="result"></output></p><script> const e = document.getElementById('demo'); const result = value => { document.getElementById("result").textContent = String(value); }; result(e.togglePopover(true));</script>Browser Compatibility
Minimum supported versions across modern rendering engines
Chrome
114
Yes
Firefox
125
Yes
Safari
17
Yes
Checked desktop BCD snapshot: HTMLElement.togglePopover base method only. Versions denote the recorded start of support (≤ means at least that early), not a guarantee of all behavior. Unresolved mirror and preview rows omitted. Options and return behavior can have separate compatibility rows.
HTML Living Standard