我想点击sweetAlert
警报上的“确定”按钮后调用引导模式。
因此,用户点击OK
提醒后的sweetAlert
按钮。它会自动调用bootstrap模态。我在javascript中尝试了下面的代码,但没有奏效。
BOOTSTRAP MODAL
<div class="modal fade" id="change_password" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body change_password">
</div>
</div>
</div>
</div>
JS CODE
<script language='javascript'>
swal({
title: 'Sample Title',
text: 'Hi',
type: 'success',
allowOutsideClick: true,
html: true
},
function () {
$('#change_password').modal('show');
});
</script>
答案 0 :(得分:1)
您的代码运行正常
swal({
title: 'Sample Title',
text: 'Hi',
type: 'success',
allowOutsideClick: true,
html: true
},
function () {
$('#change_password').modal('show');
});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="modal fade" id="change_password" role="dialog">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body change_password">
Modal body
</div>
</div>
</div>
</div>
&#13;