I am using On/Off FlipSwitch for switching state but before switching it needs user confirmation. I am using this example. Given example working fine with normal js confirm
but I want to use bootbox.js confirm. I am trying here but it is not not working.
Can anyone help me.
Try this code (demo)
$('.onoffswitch').on('click', '.onoffswitch-label', function(event) {
var checkbox = $(this).prev()[0];
event.preventDefault();
bootbox.confirm({
message: "Are you sure ?",
closeButton: false,
callback: function(result) {
if (result) {
checkbox.checked = !checkbox.checked;
$(checkbox).change();
}
}
});
});