HTML <button> popovertargetaction attribute

Definition and Usage

popovertargetaction The attribute allows you to define what happens when the button is clicked.

You can choose the "show", "hide", and "toggle" values.

Hello

If not specified popovertargetaction If the attribute is not specified, the default "toggle" value will be used.

See also:

HTML Reference Manual:HTML popover attribute

HTML Reference Manual:HTML Button popovertarget attribute

Example

When the button is clicked, the popup element will be displayed:

<h1 popover id="myheader">Hello</h1>
<button popovertarget="myheader" popovertargetaction="show">Click Me! <button>

Try It Yourself

Syntax

<button popovertarget="element_id"popovertargetaction="hide|show|toggle">

Attribute Value

Value Description Example
hide When the button is clicked, the popup element will be hidden.

Try It

show When the button is clicked, the popup element will be displayed.

Try It

toggle Default value. When the button is clicked, the popup element will toggle between hidden and visible.

Try It

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
114 114 Not Supported 17 100