引导确认框警报不起作用

bootstrap confirm box alert not working

本文关键字:不起作用 确认      更新时间:2023-09-26
<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()" />

你好。我正在尝试发出由按钮输入激活的引导确认警报。我是一个完全的初学者,所以这可能是我缺少的基本/明显的东西......任何帮助非常感谢。话筒。

件事:

  • 您的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()" />