![]() |
VOOZH | about |
Bootstrap 5 Popovers Events start off when the different popover instances are initiated.
var popoverElement = document.getElementById("popoverID");
popoverElement.addEventListener("show.bs.popover", function(){
...
});
Example 1: The code example below demonstrates how to use the show.bs.popover and hide.bs.popover events with the show() and hide() methods in popover using JavaScript. When the events are fired a message is prompted in the console (Press Ctrl+Shift+J (Windows / Linux) or Cmd+Opt+J (Mac) to open the browser console panel). The popover is placed on the right.
Output:
Example 2: The code example below demonstrates how to use the hidden.bs.popover event with the hide() method in popovers using JavaScript and an alert is shown when the event is fired. The popovers are placed at the top and left.
Output:
Reference:https://getbootstrap.com/docs/5.0/components/popovers/#events