Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootbox js : Change placement of Ok Button

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.

like image 387
Maha Dev Avatar asked May 02 '16 04:05

Maha Dev


3 Answers

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.

like image 104
khushboo29 Avatar answered Oct 22 '22 13:10

khushboo29


You can do it by CSS.

.modal-footer button {
  float:right;
  margin-left: 10px;
}

Here is working fiddle http://jsfiddle.net/9L3A9/51/

like image 6
Ankush Jain Avatar answered Oct 22 '22 12:10

Ankush Jain


In the meantime, the Bootbox team has added a new option called swapButtonOrder that you have to switch to true to do it easily.

Check my working demo with Bootbox v5 here : http://jsfiddle.net/2z8tb6fk/1/

like image 6
b126 Avatar answered Oct 22 '22 12:10

b126