Home > Web Front-end > JS Tutorial > body text

Solve jquery.validate.js multiple names with the same verification processing

巴扎黑
Release: 2017-07-23 14:59:23
Original
1690 people have browsed it
<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>
Copy after login

  // select only the first element for each name, and only those with rules specified

  //if ( this.name in rulesCache || !validator.objectLength($(this).rules( )) ) { return false; }

2. The input boxes that need to be verified on the page must have different IDs.

For example: in html:

 

 

js:

 var $form=$('form'),validator=$form.validate();

 $.extend(validator.settings,{

  rules :{

    "name":'required'

   }

 });

The above is the detailed content of Solve jquery.validate.js multiple names with the same verification processing. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template