jquery表单验证增加确认及可选不需要验证的方法

增加如下代码,可在验证后再次确认,有时候很有用,如下:

 submitHandler: function (form) {
                
if (confirm("提醒:您确定要执行此次操作吗?")) { disableOtherSubmit(); $("#btnSubmit").val("处理中..."); form.submit(); }

选择勾选项需不需要验证:

chkjedj: { required: "#chkjedj:checked" }
及以下代码:
        $("#chkjedj").click(function () {
            
var ischk = $("#chkjedj").is(":checked");
            
if (ischk) {
                document.getElementById(
"shownmmail").style.display = "inline";
                $(
'#txtzxnames').attr('disabled''');
                $(
'#txtzxemail').attr('disabled''');
            }
            
if (!ischk) {
                document.getElementById(
"shownmmail").style.display = "none";
                $(
'#txtzxnames').attr('disabled''disabled');
                $(
'#txtzxemail').attr('disabled''disabled');
            }
        });

原文地址:https://www.cnblogs.com/cnaspnet/p/2009753.html