X-editable with confirmation prompt using bootbox.

2019-09-05 02:21发布

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/

0条回答
登录 后发表回答