问题
I'm trying to add a confirm prompt into x-editable plugin. If I add using a normal javascript, it works. However, if I try to implement bootbox plugin, it fails. Below is an example of using a normal javascript that works.
if(!confirm("Are you sure you wish to proceed?")){
$('#name2').editable('toggle');
return "invalid";
}
But if I add bootbox plugin like the example below, it fails to work. It actually change the value before the confirmation.
bootbox.confirm("Are you sure you want to cancel?", function(result) {
if(result == 'false'){
return "invalid";
} else {
return "";
}
});
Here's the jsfiddle for bigger picture. https://jsfiddle.net/f8vjmqtq/11/
来源:https://stackoverflow.com/questions/32344594/x-editable-with-confirmation-prompt-using-bootbox-js