HTMLElement: hidePopover() method

The HTMLElement.hidePopover() method opens an element that has a valid popover attribute.

When hidePopover() is called on an element with the popover attribute that is currently open, then a beforetoggle non-cancelable event will be fired, followed by the popover closing, and a toggle event will be fired. If the element is already closed, then nothing will happen.

Syntax

hidePopover()

Parameters

None.

Return value

None (undefined).

Examples

Open a popover when moving the mouse pointer over a button:

HTML

<button onmouseover="myFunction()">Hover Menu</button>
<div id="myPopover">Popover</div>

JavaScript

// On mouse-over, execute myFunction
function myFunction() {
  document.getElementById("myPopover").hidePopover();
}

Specifications

Specification
HTML Standard
# dom-hidepopover

Browser compatibility

BCD tables only load in the browser

See also