Create Bootstrap 5 Modals With Custom Actions

Category: Javascript , Modal & Popup | December 31, 2020
Author:zFunx
Views Total:540 views
Official Page:Go to website
Last Update:December 31, 2020
License:MIT

Preview:

Create Bootstrap 5 Modals With Custom Actions

Description:

A simple Bootstrap extension that enables you to dynamically create Bootstrap 5 modal popups with custom actions.

How to use it:

1. Download and load the main script modal-with-custom-action.js into your Bootstrap 5 project.

// Bootstrap 5 Files
<link rel="stylesheet" href="/path/to/cdn/bootstrap.min.css" />
<script src="/path/to/cdn/modal-with-custom-action.js"></script>
// Custom Modal JavaScript
<script src="modal-with-custom-action.js"></script>

2. Display a Bootstrap 5 modal window on the screen. Possible parameters:

// showModal(title, description, yesBtnLabel = 'Yes', noBtnLabel = 'Cancel', callback)
showModal('File Deletion', 'Do you want to delete this file?', "Yes", "No", () => {
  console.log('File deleted successfully');
});

You Might Be Interested In:


Leave a Reply