boot4modal.js Easy & Light weight Javascripts lib allow you to create alert or confirm popups based on Bootstrap 4.3.1 modals
Dependencies
- Bootrap version 4.3.1
- Jquery version 3.3.1
- Popper.js version 1.14.7
- Alert message
<script>
boot4.alert(
{
title: 'boot4modal alert popup',
msg: 'This is a simple alert popup',
centered: true
}
);
</script>
- Alert message with callback function
<script>
boot4.alert(
{
title: 'boot4modal alert with callback',
msg: 'This alert have a callback to listen button click',
buttons_labels: {
ok_btn: 'Understand',
},
centered: true,
callback: function () {
alert('you\'re in callback method');
}
}
);
</script>
- Confirm message
<script>
boot4.confirm(
{
title: 'boot4modal confirm popup',
msg: 'This is a confirm popup, callback is run on each buttons',
buttons_labels: {
cancel_btn: 'Cancel',
ok_btn: 'Ok'
},
centered: true,
callback: function (result) {
if (result) {
alert("ok clicked");
}
else {
alert("cancel clicked");
}
}
}
);
</script>
just add this in your template
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/MkLHX/[email protected]/boot4modal.js"></script>;
Enjoy and use it!