本文介绍了MVC验证,表单提交,光标等待问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表单,提交后会转动光标:等待.但是,如果MVC验证由于需要该属性而给出错误消息,则光标不会返回.我该如何处理?这是我现在处理的方式.我搜索了论坛,但没有任何反应.谢谢.
I have a form, when submitted, will turn the cursor: waiting. However if the MVC validation gives an error message because the property is required, the cursor does not turn back. How can I handle this? Here is how I am handling it now. I searched the forums, but nothing is working. Thank you.
$("form").submit(function () {
//if MVC validation fails do not do this
$("*").css("cursor", "wait");
});
jQuery(window).load( function () {
//called after the load is finished.
$("*").css("cursor", "auto");
});
推荐答案
您应该检查表单是否有效,然后才能旋转光标.
You should check whether the form is valid then you can turn the cursor.
$(function () {
$("form").submit(function () {
if ($(this).valid()) {
$("*").css("cursor", "wait");
}
});
});
这篇关于MVC验证,表单提交,光标等待问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!