Bootbox js : Change placement of Ok Button

Maha Dev picture Maha Dev · May 2, 2016 · Viewed 8.2k times · Source

In bootbox.js, by default Ok button showing after Cancel button. I want it to be first and then cancel. Here is the situation of current scenario,

http://paynedigital.com/img/confirm-simple.png

I need Ok button first. I have scene its documentation but didn't find a way to do it.

Answer

khushboo29 picture khushboo29 · May 2, 2016

You can change order of the buttons. Try:

 bootbox.confirm({
     title: "danger - danger - danger",
     message: "Are you sure of this?",
     buttons: {
        cancel: {
        label: "Cancel",
        className: "btn-default pull-right"
     },
     confirm: {
        label: "Delete",
        className: "btn-danger pull-left"
    }
  },
  callback: function(result) {
    // Do your stuff here
  }
});

Hope this works for you.