关于数据更改的Bootstrap模型关闭确认消息 [英] Bootstrap model close confirmation message on data change
问题描述
亲爱的会员,
我在mvc做项目。我在bootstrap模型中有我的表单用于保存,我需要显示一条消息,如果我在任何输入框中键入任何内容并单击关闭。
数据未保存你确定要离开表格而不保存数据我需要向用户显示确认信息。
请帮助
我尝试过:
var unsaved = false ;
$(:input)。change(function(){
unsaved = true;
});
$('#createJobFunction')。on('hidden.bs.modal',function(e) {
alert(工作功能未保存。您确定要离开而不保存数据吗?);
})
i尝试调用'hidden.bs.modal'模型事件。但他的火灾还在提交。当我提交表格
(:input)时,我想要解雇这个.change(function(){
unsaved = true;
});
>
('#createJobFunction')。on('hidden.bs.modal',function(e){
alert(工作功能未保存。你确定要离开吗?保存数据?);
})
i尝试调用模型的'hidden.bs.modal'事件。但他的火灾还在提交。当我提交表格时,我不希望这被解雇
试试这个
< span class =code-keyword>< !DOCTYPE html >
< html ng-app = myApp >
< head >
< link rel = stylesheet href = http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\">
< script src = https://ajax.googleapis.com/ajax/libs/jquery/ 1.12.4 / jquery.min.js > < / script >
< script src = http://maxcdn.bootstrapcdn .com / bootstrap / 3.3.6 / js / bootstrap.min.js > < / script >
< script > 跨度>
Dear Members,
I am doing project in mvc. I have my forms in bootstrap model for saving and i need to show a message,if i typed anything on any input box and click on close.
"Data Not Saved. Are you Sure you want to leave the form with out saving the data" i need to show a confirmation message to users.
please help
What I have tried:
var unsaved = false;
$(":input").change(function () {
unsaved = true;
});
$('#createJobFunction').on('hidden.bs.modal', function (e) {
alert("Job Function Not Saved. Are you Sure you want to leave with out saving the data?");
})
i tried calling 'hidden.bs.modal' event of model. but his fires on submit also. i dnt want this to be fired when i submit the form
(":input").change(function () {
unsaved = true;
});
('#createJobFunction').on('hidden.bs.modal', function (e) {
alert("Job Function Not Saved. Are you Sure you want to leave with out saving the data?");
})
i tried calling 'hidden.bs.modal' event of model. but his fires on submit also. i dnt want this to be fired when i submit the form
try this
<!DOCTYPE html> <html ng-app="myApp"> <head> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script>
这篇关于关于数据更改的Bootstrap模型关闭确认消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!