<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.2/jquery-confirm.min.css">
<script src='./jquery-3.4.1.min.js'></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.2/jquery-confirm.min.js"></script>
<meta charset="utf-8" />
</head>
<body>
<button class="btn">点击</button>
</body>
<script>
$(function() {
$("button.btn").click(function(){
$.confirm({
title: '你确定要做这个事情吗',
content: '你做的事情可能造成IT行业的科技革命',
buttons: {
ok: {
text: '确定',
btnClass: 'btn-primary',
action: function() {
console.log('同意')
}
},
cancel: {
text: '取消',
brnClass: 'btn-primary',
action: function() {
console.log('取消')
}
}
}
})
})
})
</script>
</html>