Validating several fields with the same name using jQuery Validate
问题 I have an HTML form that I'm processing with Perl CGI, like so: <form action="process.cgi" id="main"> <input type="text" name="foo" class="required" /> <input type="text" name="foo" class="required" /> <input type="text" name="foo" class="required" /> </form> And I'm validating it with the jQuery Validation plugin. Trouble is, when I call $('#main').valid() , it only checks that the first field is non-empty. How to I get it to check all the fields? 回答1: OFFICIAL DOCUMENTATION: