<code style='margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, serif; white-space: inherit'><span style="color: #666666; font-family: 微软雅黑; line-height: 24px;">1、将引入的插件:jquery.validate.js 第<span style="color: #666666; font-family: 微软雅黑; line-height: 24px;">484行的代码注释:<br></span></span></code>
// select only the first element for each name, and only those with rules specified
//if ( this.name in rulesCache || !validator.objectLength($(this. )) ) { return false; }
2、頁面中需要驗證的輸入框必須加上不同的id。
如:html中:
# js:
var $form=$('form'),validator=$form.validate();
$.extend(validator.settings,{
rules :{
"name":'required'
}
});
以上是解決jquery.validate.js 多個name相同驗證處理的詳細內容。更多資訊請關注PHP中文網其他相關文章!