如果尚未提交表单,我需要禁用LI菜单项。如果用户试图点击我想要显示的警报,甚至是告诉用户的promt或者为用户提供以下选项
alert("We are sorry as this is a new business lead, you need to save the information first.");
或
promt("we understand that you want to continue, please click ok for us to save the information you have inputted");
答案 0 :(得分:0)
很多方法,尝试:
$.ajax({
...
beforeSend: function() {
if (isMyFormSubmitted()) {
$('li').click(function() {
alert('...');
});
} else {
$('li').click(function() {
prompt('...');
});
}
}
});
isMyFormSubmitted()
是一些返回true或false的函数,具体取决于表单是否已提交。显然,您必须遍历所有字段才能查看该函数中是否有任何更改。