bootstrap-show-modal
jQuery plugin to create bootstrap 4 modals in pure JavaScript.
Demo Page
Installation
npm install -save bootstrap-show-modal
Or just download this repository and include src/bootstrap-show-modal.js
.
Usage
Simple Modal
$.showModal({title: "Hello World!", body: "A very simple modal dialog without buttons."})
Alert Dialog
$.showAlert({title: "Hi", body: "Please press ok, if you like or dislike cookies."})
Confirm Dialog
$.showConfirm({
title: "Please confirm", body: "Do you like cats?", textTrue: "Yes", textFalse: "No",
onSubmit: function (result) {
if (result) {
$.showAlert({title: "Result: " + result, body: "You like cats."})
} else {
$.showAlert({title: "Result: " + result, body: "You don't like cats."})
}
},
onDispose: function() {
console.log("The confirm dialog vanished")
}
})
Properties
props = {
title: "",
body: "",
footer: "",
modalClass: "fade",
modalDialogClass: "",
options: null,
onCreate: null,
onDispose: null,
onSubmit: null
}
Also see the Bootstrap 4 Modal documentation.