2

Can anyone tell me how I should change the ok & cancel option of the Bootbox to 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());
    }
  });
}
mickmackusa
  • 43,625
  • 12
  • 83
  • 136
Deb
  • 265
  • 1
  • 3
  • 16

1 Answers1

5

You could pass buttons object to change the buttons label and style this way :

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());
    }

  }
});

Hope this helps.

Zakaria Acharki
  • 66,747
  • 15
  • 75
  • 101