js表单验证,这是个人做的总结,需要的请留言
需要文件:jquery.js, validator.js, validator.css, add.xml
xml文件:
<?xml version="1.0" encoding="utf-8"?>
<root box="errorbox">
<username>
<required>请填写姓名</required>
</username>
<content>
<required>请填写内容</required>
</content>
。。。。。。 //还可以填写更多内容
</root>
html内嵌套的脚本文件
|
1
2
3
4
5
6
7
8
9
10 |
<script type="text/javascript"> $(function(){ $.validate.setConfigs({ xmlPath:‘public/xml/‘ }); $(document).ready(function(){ $(‘#book_add‘).validate(); }); })</script> |
OKay,基本上可以检验除与服务器交互的表单验证了
---恢复内容结束---
原文:http://www.cnblogs.com/eyeSpace/p/3772265.html