This article introduces you to the jquery.validate.js processing method of multiple identical names through code. It is very good and has reference value. Friends who need it can refer to it. I hope it can help everyone.
1. Plug-in to be introduced: jquery.validate.js Code comment on line 484:
// 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. Input box that needs to be verified on the page A different id must be added.
For example: in html:
##
<form> <input type='text' name='name' id='name1' val=''/> <input type='text' name='name' id='name2' val=''/> </form>
var $form=$('form'),validator=$form.validate(); $.extend(validator.settings,{ rules:{ "name":'required' } });
Solution to the problem of using jQuery to dynamically operate name in IE7
Detailed example of node.js using fs.rename to force rename or move a folder
Use the name attribute of html to get the dom element
The above is the detailed content of jquery.validate.js Detailed explanation of how to handle multiple identical names. For more information, please follow other related articles on the PHP Chinese website!