bootstrap 确认框警报不起作用

bootstrap confirm box alert not working

<head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js">
    src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js">
  </script>
</head>

<script>
function confirm() {
BootstrapDialog.confirm('Are you sure you want to do this?');}
</script>

<input type="button" value="confirm" onclick="confirm()" />

你好。我正在尝试发出 bootstrap 确认警报,该警报由按钮输入激活。我是一个完全的初学者,所以我可能缺少 fundamental/obvious 的东西......非常感谢任何帮助。迈克.

几件事:

  • 您的 script 标签不正确,需要修复
  • 您很可能需要 bootstrap.css
  • 您需要添加bootstrap-dialog.js

 function confirm() {
   BootstrapDialog.confirm('Are you sure you want to do this?');
 }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.35.1/js/bootstrap-dialog.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />

<input type="button" value="confirm" onclick="confirm()" />