我的页面上有一个按钮,当它被按下时,它会触发一些 javascript 函数,以及其中一个用于打开引导模式的 javascript 函数,但我似乎无法让它工作。这是我的代码......请帮忙。
//elsewhere on the form is the button that triggers the javascript
<a href="#" class="btn btn-danger" id="cancelPObtn" data-dismiss="modal">Yes, cancel it</a>
<!-- CANCEL A PO MODAL -->
<div class="modal hide fade" id="error-dialog" style="display: none;">
<div class="modal-header">
<a class="close" data-dismiss="modal">x</a>
<h3>Cancel Purchase Order?</h3>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<a href="#" class="btn btn-danger btn-modal btn-cancel" data-dismiss="modal">Yes, cancel it</a>
<a href="#" class="btn" data-dismiss="modal">Nevermind</a>
</div>
</div>
$('.btn-danger').click(function(event) {
if(some random conditional statement){
//some stuff happens here
}
else{
//Show form validation error modal-- I know this part is triggered but the modal will not show
$("#error-dialog").modal("show");
}
});