如上所述,如何使用jQuery Validate从表单中删除所有必需的规则?
这就是我现在所说的:
var settings = $('form').validate().settings; //alert(settings.rules.toSource()); for (var i in settings.rules){ alert(i); delete settings.rules.i; // ^ not sure about how to do this properly,// and how to just delete the 'required' rule and keep the rest intact }
jQuery Validate本机的函数返回一个未定义的错误:
$("input,select,textarea").rules('remove','required');