无法更改 Bootbox 中确认框的按钮颜色

Unable to change the button color of confirm box in Bootbox

在Bootbox中,我无法更改confiem box的按钮颜色,请帮助我

这是我的代码:

bootbox.confirm('This action removes all partners from this project and resets all existing stock distribution. <br /> <br /> Do you wish to continue?','Cancel','Remove', function (result) {
    if (result == true) {
        //do something
    }
});

bootbox 允许您将 类 添加到按钮。有关工作示例,请参见以下代码段。在 css 文件中放入任何样式,或者最好坚持使用标准 bootstrap 颜色以保持一致性。在示例中,我使用 btn-danger 和 btn-default bootstrap 类 以及 pull-right 和 pull-left,但您可以使用任何 [=32] =]你想要

如果您仍然遇到问题,可能是您的 bootbox 与 bootstrap 和 jquery 版本不匹配?

bootbox.confirm({
  message: 'This action removes all partners from this project and resets all existing stock distribution. <br /> <br /> Do you wish to continue?',
  buttons: {
    'cancel': {
      label: 'Cancel',
      className: 'btn-default pull-left'
    },
    'confirm': {
      label: 'Remove',
      className: 'btn-danger pull-right'
    }
  },
  callback: function(result) {
    if (result) {
      // whatever you want to do here
      console.log(result)
    }
  }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script src="https://github.com/makeusabrew/bootbox/releases/download/v4.4.0/bootbox.min.js"></script>

你可以使用 CSS

<style>
     .bootbox-confirm div div div button.btn-primary{
         background-color: orange
     }
 </style>