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;
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745503466a4630521.html
评论列表(0条)