Bootbox并确认消息

时间:2016-07-13 11:51:06

标签: javascript bootbox

我只使用基本的确认消息,但没有显示消息。

bootbox.confirm("Are you sure?", "No", "Yes", function(result) {
    alert("test");
  });

http://jsfiddle.net/fjd3zzdm/

2 个答案:

答案 0 :(得分:0)

您可以使用Custom dialog

bootbox.dialog({
    message:"Are you sure?",
    buttons: {
      yes: { //Button Yes
        label: "Yes",
        className: "btn-success",
        callback: function(result) { //Do whatever you want here
            alert("test");   
        }
      },
      no: { //Button No
         label: "No",
        className: "btn-danger",
        callback: function() {}
      }
    }
}); 

在这里工作Fiddle! :)

答案 1 :(得分:0)

<script>
        $('#form').submit(function (e) {
            e.preventDefault();

            var form = this;
            bootbox.confirm("Are you sure you want to delete this?", function (result) {
                if (result) {
                    form.submit();
                }
            });
        });
</script>

这在asp.net core中有效 将整个表单ID命名为(form)