VOOZH about

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

⇱ Bootstrap 5 Popovers toggle() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Bootstrap 5 Popovers toggle() Method

Last Updated : 24 Jul, 2024

Bootstrap 5 Popovers toggle() method is used to toggle the visibility of the popover. The toggle() method can be used in place of the show() and hide() methods to change the visibility of the popover. The toggle() method returns to the caller before the popover is actually shown or hidden from the screen.

Syntax:

const element = new bootstrap.Popover.getOrCreateInstance("#popoverID");
element.toggle();

Parameters:

The popover toggle method does not accept any parameters.

Return Value:

This method does not return anything to the caller. It just toggles the popover of an element.

Example 1: In this example, we used the popover toggle method to toggle the visibility of the popover of an element.

Output:

Example 2: In this example, we used the toggle method of the popover with the show and the hide method.

Output:

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

Comment

Explore