Trying to find a way to add a fa spinner icon to a bootbox dialog button when clicked. Experimenting in the callback changing the fa icon but it changes after the code has executed, see code below. Any suggestions?
bootbox.dialog({
title: "Dialog",
message: "Text",
buttons: {
cancel: {
label: "Cancel",
className: 'btn-default',
callback: function(){
}
},
noclose: {
label: "<i class="fa fa-check"></i> OK",
className: 'btn-primary',
callback: function(){
$("[data-bb-handler='noclose']").find(".fa").replaceWith('<i class="fa fa-spinner fa-spin fa-fw"></i>');
//rest of callback code
}
}
}
});