我知道这个问题听起来很幼稚,但没有想到其他标题。
我正在使用bootstrap modal
事件hide.bs.modal
中的一个,该事件在模式消失之前被调用,以显示确认框。回调需要一个布尔值。
$('#the-modal').on('hide.bs.modal',function () {
var self = this;
$.cofirm("are your sure you want to close",function() { // gets fired if confirmed
$(self).modal("hide"); // cannot do this,it will fire the event hide.bs.modal over and over.
});
return false; // obviously,this gets called first,but that's alright
}
我不是使用传统的confirm
,而是使用具有自己回调的jquery插件。
$(self).modal("hide");
无法做到这一点,它将一再触发事件hide.bs.modal
。