[英]Bootstrap Modal not closing on X or Close button, but does on ESC or clicking in the overlay
[英]Can you get the 'x' (close) button on a bootstrap modal to call a javascript function instead of closing the modal?
我正在实现自举程序模式,需要更改“关闭”按钮的功能(右上角的小x)。 我希望调用javascript函数而不是关闭modal 。 这是针对研究项目的,而不是针对生产网站的(我意识到,在实时站点上,这可能总是一个坏主意)。
是的,您只需要使用模式的“隐藏”事件。 参见文档。
$("#exampleModal").on("hide.bs.modal", function(event){
event.preventDefault();
//do whatever here
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.