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>
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. | |
show | When the button is clicked, the popup element will be displayed. | |
toggle | Default value. When the button is clicked, the popup element will toggle between hidden and visible. |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
114 | 114 | Not Supported | 17 | 100 |