![]() |
VOOZH | about |
Bootstrap 5 Collapse Methods are used to control the visibility of a Bootstrap 5 Collapse element, manually.
Bootstrap 5 Collapse Methods:
Syntax:
collapse.collapse_method();Below examples illustrate the Bootstrap 5 Collapse Methods:
Example 1: In this example, we will show and hide the collapsible element using the "show" and "hide" methods given by the Bootstrap 5 collapse object.
Output:
Example 2: In this example, we will toggle and dispose of the collapsible element using the "toggle" and "dispose" methods given by the Bootstrap 5 Collapse object. Once we dispose of a collapsible element, we cannot use any methods given by Bootstrap 5 to collapse object as it gets destroyed in the DOM.
Output:
Reference: https://getbootstrap.com/docs/5.0/components/collapse/#methods