HTML <button> popovertargetaction 属性

定义和用法

popovertargetaction 属性允许您定义单击按钮时会发生什么。

您可以选择 "show"、"hide" 和 "toggle" 值。

Hello

如果未指定 popovertargetaction 属性,则将使用默认的 "toggle" 值。

另请参阅:

HTML 参考手册:HTML popover ປະກອບ

HTML 参考手册:HTML Button popovertarget 属性

Example

Clicking the button will show the popup element:

<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 Clicking the button will hide the popup element.

Try It

show Clicking the button will show the popup element.

Try It

toggle Default value. Clicking the button will toggle the visibility of the popup element.

Try It

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
114 114 ບໍ່ສາມາດດຳເນີນ 17 100