日期:2014-05-17 浏览次数:20489 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="../lib/jquery.js" type="text/javascript"></script> <script src="../jquery.validate.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $("#user").validate( { rules: { name: { required: true, minlength: 5 }, pass: { required: true } } }); }); </script> </head> <body> <form id="user" method="post"> <label> Name</label> <input name="name" type="text" value="" /> <label> Pass</label> <input name="pass" type="text" value="" /> <label> Email</label> <input name="email" type="text" value="" /> <input type="submit" value="submit" /> </form> </body> </html>
<script type="text/javascript"> $(function() { $("#user").validate( { rules: { name: { required: true, minlength: 5 }, pass: { required: true }, email:{ required: true, email: true } } }); }); </script>
------解决方案--------------------