MVC Validation, Form Submit, Cursor Waiting Issue

爷,独闯天下 提交于 2019-12-24 16:12:40

问题


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");
});

回答1:


You should check whether the form is valid then you can turn the cursor.

$(function () {
    $("form").submit(function () {
        if ($(this).valid()) {
           $("*").css("cursor", "wait");
        }
    });
});


来源:https://stackoverflow.com/questions/21633201/mvc-validation-form-submit-cursor-waiting-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!