将bootbox的ok取消选项更改为yes&没有

时间:2017-11-24 12:02:57

标签: javascript jquery laravel bootbox

任何人都可以告诉我应该如何更改ok& Bootbox的cancel选项yes& no

function deletelaw(id) {
  bootbox.confirm('Are you sure you want to delete?', function(result) {
    if (result) {
      $("#deletelaw_" + id).hide();
      $(".law1_" + id).prop("checked", false);
      var splits = $("#laws_assigned1").val().split(",");

      var finalSplit = [];
      for (var i = 0; i < splits.length; i++) {
        if (id != splits[i]) {
          finalSplit.push(splits[i]);
        }
      }
      $("#laws_assigned1").val(finalSplit.join());
    }
  });
}

1 个答案:

答案 0 :(得分:4)

您可以通过 Developer Samples - Runtime Permissions 对象来更改按钮标签和样式:

bootbox.confirm({
  message: "Are you sure you want to delete?",
  buttons: {
    confirm: {
      label: 'Yes',
      className: 'btn-class-here'
    },
    cancel: {
      label: 'No',
      className: 'btn-class-here'
    }
  },
  callback: function (result) {
    if (result) {
      $("#deletelaw_" + id).hide();
      $(".law1_" + id).prop("checked",false);
      var splits = $("#laws_assigned1").val().split(",");

      var finalSplit = [];
      for (var i = 0; i < splits.length; i++) {
        if (id != splits[i]) {
          finalSplit.push(splits[i]);
        }
      }
      $("#laws_assigned1").val(finalSplit.join());
    }

  }
});

希望这有帮助。