Bootstrap is a CSS framework for building modern and responsive applications that look good on desktop computers, tablets, and mobile devices.
In this lecture, we will learn how to replace a native JavaScript confirmation box with a Bootstrap dialog box.
One way to use a Bootstrap dialog box is by following the steps explained in the Bootstrap website.
An easier way is to use a library called Bootbox, which provides simple functions to create different kinds of dialog boxes. More information about Bootbox and its features can be found on their website bootbox.js.com.
To add Bootbox to our project, we need to open the Package Manager Console and type 'install package bootbox' with the version set to 4.3.0.
The necessary Bootstrap files, bootbox.js, and bootbox.min.js (the compressed version), are added to the scripts folder of our Solution Explorer.
We then add a reference to bootbox.js in our bundle, which can be done in the BundleConfig file.
In our index.cshtml file, we replace the native confirm function with the bootbox.confirm function.
Instead of returning a Boolean, the bootbox.confirm function takes a callback function as a parameter.
If the result of the callback function is truthy, we make an AJAX call to delete the customer.
After building and refreshing the browser, we can see the Bootstrap dialog box in action, which looks much better than the native JavaScript confirmation box.
Next, we will discuss a slight optimization of our jQuery code.
video txt