Icons for bootbox js dialog boxes
Has anyone figured out how to add icons to buttons in bootbox.js window? I would like to add icons to the No and Yes buttons in this function:
$(function () {
$(".confirm-delete").click(function(e) {
e.preventDefault();
var id = $(this).data('id')
bootbox.confirm("Remove this product?", "No", "Yes", function(confirmed) {
if(confirmed) {
deleteRecord(id);
}
});
});
});
+3
source to share
2 answers
You need to create a custom dialog and use the option icon
added in 2.1.0 .
For example:
$(function () {
$(".confirm-delete").click(function(e) {
e.preventDefault();
var id = $(this).data('id')
bootbox.dialog("Remove this product?", [{
"label" : "No",
"icon" : "icon-remove"
}, {
"label" : "Yes",
"icon" : "icon-ok icon-white",
"callback": function() {
deleteRecord(id);
}
}]);
});
});
+3
source to share
bootbox.confirm({
title: "Destroy planet?",
message: "Do you want to activate the Deathstar now? This cannot be undone.",
buttons: {
cancel: {
label: '<i class="fa fa-times"></i> Cancel'
},
confirm: {
label: '<i class="fa fa-check"></i> Confirm'
}
},
callback: function (result) {
console.log('This was logged in the callback: ' + result);
}
});
0
source to share