![]() |
VOOZH | about |
Bootstrap 5 Modal plugin is used to create a customized webpage where we can add dialog boxes for user notifications and lightboxes. Bootstrap 5 modal can hide the content on demand with the help of JavaScript or via data attributes. Default scrolling behavior can also be overridden by modal and it gives a click area for dismissing the models which are shown on the webpage by using the .modal-backdrop class.
We will discuss the usage of Bootstrap 5 Modal usages.
Bootstrap 5 Modal Usage
Example 1: The following code triggers a modal with id "modal".
Output:
Example 2: The following code toggles the modal using JavaScript. The modal will be automatically toggled.
Output:
Example 3: The following code is used to see the example of show.bs.modal where we can open to modal alternatively.
Output:
Reference: https://getbootstrap.com/docs/5.0/components/modal/#usage