Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP C C++ C# AWS W3.CSS HOW TO BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST TOOLS

HTML <button> popovertargetaction Attribute

HTML <button> tag

Example

Create two buttons: one for "Show" popover, and one for "Hide" popover:

<button popovertarget="tip1" popovertargetaction="show">Show</button>
<button popovertarget="tip1" popovertargetaction="hide">Hide</button>

<div id="tip1" popover>
Here we can show a helpful tip.
</div>
Try it Yourself »

Definition and Usage

The popovertargetaction attribute defines what happens to the targeted popover element when you click the button.

Legal values are: "show", "hide", and "toggle".

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


Syntax

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

Attribute Values

Value Description
hide Hides the popover element when button is clicked Try it »
show Shows the popover element when button is clicked Try it »
toggle Default value. The popover element is toggled between hidding and showing when the button is clicked Try it »


Browser Support

Attribute
popovertargetaction 114 114 125 17 100

Related Pages

HTML global attributes: popover

HTML <button> attribute: popovertarget

HTML tutorial: Popover API


HTML <button> tag

Free account

Track your progress

XP earned 0 Day streak 0 Spaces 0 League —

New

Learn in Adventure Mode W3Schools Adventure App

Coding fundamentals as bite-sized lessons and challenges.

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.