jQuery validation not working with Chrome or IE8 -
i trying use jquery validation, , not validate upon submit. if remove rules, , add required firstname field, work under chrome, not ie8. sits, won't work under either chrome or ie8. know ie8 has quirks, unfortunately client requires ie8, apparently missing something. advice?
<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>validation test</title> <script type="text/javascript" src="${pagecontext.request.contextpath}/resources/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="${pagecontext.request.contextpath}/resources/js/jquery.validate.min.js"></script> <script type="text/javascript"> $(function(){ $("#main_form").validate({ rules: { firstname: { required: true } } }) }); </script> </head> <body> <form id="main_form"> <div> <label for="firstname">first name</label> <input type="text" id="firstname"> </div> <div> <label for="lastname">last name</label> <input type="text" id="lastname"> </div> <div> <label for="address1">address 1</label> <input type="text" id="address1"> </div> <div> <label for="address2">address 2</label> <input type="text" id="address2"> </div> <div> <label for="citystate">city/state</label> <input type="text" id="citystate"> </div> <div> <button type="submit">search</button> </div> </form> </body> </html>
check out faq jquery-validate tag.
rules defined input name attributes, not id, when declared within rules option of validate().
so need add name attributes each of input fields, so:
<input type="text" id="firstname" name="firstname">
Comments
Post a Comment