admin管理员组文章数量:1023213
I have a bootstrap modal. When it is closed some instructions are executed. But now I want to ask if user really want to close it (with a confirm window) What can i do?
Here is my code at the moment.
$('#modal').on("hide.bs.modal", function (e) {
//Instructions to execute when the modal is closed
});
I have a bootstrap modal. When it is closed some instructions are executed. But now I want to ask if user really want to close it (with a confirm window) What can i do?
Here is my code at the moment.
$('#modal').on("hide.bs.modal", function (e) {
//Instructions to execute when the modal is closed
});
Share
Improve this question
asked Mar 1, 2016 at 5:15
Pablo De LucaPablo De Luca
8233 gold badges16 silver badges31 bronze badges
2 Answers
Reset to default 8Like this?
$('#modal').on("hide.bs.modal", function (e) {
if(confirm("Are you sure, you want to close?")) return true;
else return false;
});
Or, just like this:
$('#modal').on("hide.bs.modal", function (e) {
if(!confirm("Are you sure, you want to close?")) return false;
});
$('#modal').on("hide.bs.modal", function (e) {
//Instructions to execute when the modal is closed
if(!confirm("Are you sure, you want to close?")) return false;
});
I have a bootstrap modal. When it is closed some instructions are executed. But now I want to ask if user really want to close it (with a confirm window) What can i do?
Here is my code at the moment.
$('#modal').on("hide.bs.modal", function (e) {
//Instructions to execute when the modal is closed
});
I have a bootstrap modal. When it is closed some instructions are executed. But now I want to ask if user really want to close it (with a confirm window) What can i do?
Here is my code at the moment.
$('#modal').on("hide.bs.modal", function (e) {
//Instructions to execute when the modal is closed
});
Share
Improve this question
asked Mar 1, 2016 at 5:15
Pablo De LucaPablo De Luca
8233 gold badges16 silver badges31 bronze badges
2 Answers
Reset to default 8Like this?
$('#modal').on("hide.bs.modal", function (e) {
if(confirm("Are you sure, you want to close?")) return true;
else return false;
});
Or, just like this:
$('#modal').on("hide.bs.modal", function (e) {
if(!confirm("Are you sure, you want to close?")) return false;
});
$('#modal').on("hide.bs.modal", function (e) {
//Instructions to execute when the modal is closed
if(!confirm("Are you sure, you want to close?")) return false;
});
本文标签: javascriptAsk if user really want to close bootstrap modalStack Overflow
版权声明:本文标题:javascript - Ask if user really want to close bootstrap modal - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745503464a2153497.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论