VOOZH about

URL: https://www.geeksforgeeks.org/bootstrap/bootstrap-5-tooltips-toggle-method/

⇱ Bootstrap 5 Tooltips toggle() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Bootstrap 5 Tooltips toggle() Method

Last Updated : 25 Jul, 2024

Bootstrap 5 Tooltips toggle() method is used to toggle a tooltip's visibility manually. Calling it an odd number of times on a tooltip makes it visible, and calling it an even number of times makes it hidden. 

Syntax:

tooltip.toggle()

Return Value:

The user receives a direct response from this method before the tooltip is ever displayed or hidden.

Example 1:

In this example, we will create Bootstrap 5 Tooltips and call toggle on the tooltip which is positioned to appear on the top of the button.

Output:

👁 Recording-2024-07-24-at-222037-(1)

Example 2:

In this example, we will create Bootstrap 5 Tooltips and call toggle 2 times on the tooltip which is positioned to appear on the top of the button. Calling toggle 2 times nullifies the toggle method's effects, so the user would see no difference at all on both tooltips.

Output:

👁 gif-2

Reference:https://getbootstrap.com/docs/5.0/components/tooltips/#toggle

Comment

Explore