简体   繁体   中英

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

Hi. I'm trying to make a bootstrap confirm alert which is activated by a button input. I'm a total beginner, so it's probably something fundamental/obvious that I'm missing... Any help very much appreciated. Mike.

a few things:

  • your script tag is incorrect, need to be fixed
  • you most likely need the bootstrap.css
  • you need to add 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()" /> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM