jquery插件validate驗證的小例子
<!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="Jquery1.7.js" type="text/javascript"></script>
<script src="jquery.validate.js" type="text/javascript"></script>
<script src="messages_cn.js" type="text/javascript"></script>
<script type="text/javascript">
// $(function () {
// $('#a').validate({
// rules: {
// username: { required: true, minlength: 6, maxlength: 12 },
// email: { required: true, email: true }
// },
// errorshow: function (error, element) {
// error.appendTo(element.siblings('span'));
// }
// })
// })
$(function () {
$('#a').validate({
rules: {
username: { required: true, minlength: 6, maxlength: 12 },
email: { required: true, email: true },
pwd: { required: true, rangelength:[6,6] },
again: { required: true, equalTo: ($('#aa')) }, //這里一定是id
birthday:{date:true},
blood:{digits:true}
},
errorshow: function (error, element) {
error.appendTo(element.siblings('span'));
}
})
})
</script>
</head>
<body>
<form id="a">
<div>
用戶名:<input type="text" name="username" /><span style="width:100px"></span>
<br />
郵箱:<input type="text" name="email" /><span style="width:100px"></span>
<br />
密碼:<input type="text" name="pwd" /><span style="width:100px" id="aa"></span>
<br />
確認(rèn)密碼:<input type="text" name="again" /><span style="width:100px"></span>
<br />
生日:<input type="text" name="birthday" /><span style="width:100px"></span>
<br />
血壓:<input type="text" name="blood" /><span style="width:100px"></span>
</div>
</form>
</body>
</html>
- jQuery驗證插件 Validate詳解
- JQuery擴(kuò)展插件Validate—4設(shè)置錯誤提示的樣式
- JQuery擴(kuò)展插件Validate—6 radio、checkbox、select的驗證
- JQuery擴(kuò)展插件Validate 5添加自定義驗證方法
- jValidate 基于jQuery的表單驗證插件
- jQuery驗證插件validate使用方法詳解
- jQuery插件Validate實(shí)現(xiàn)自定義校驗結(jié)果樣式
- jQuery插件Validate實(shí)現(xiàn)自定義表單驗證
- Jquery插件 easyUI屬性匯總
- Jquery插件之多圖片異步上傳
- jQuery Dialog 彈出層對話框插件
- 強(qiáng)烈推薦240多個jQuery插件提供下載
- 分享20多個很棒的jQuery 文件上傳插件或教程
- jQuery validate插件功能與用法詳解
相關(guān)文章
詳解Jquery EasyUI tree 的異步加載(遍歷指定文件夾,根據(jù)文件夾內(nèi)的文件生成tree)
本篇文章主要介紹了Jquery EasyUI tree 的異步加載,可以實(shí)現(xiàn)遍歷指定文件夾,根據(jù)文件夾內(nèi)的文件生成tree,有興趣的可以了解一下。2017-02-02setInterval與clearInterval的使用示例代碼
本篇主要是對setInterval與clearInterval的使用示例代碼進(jìn)行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助2014-01-01使用jQuery將多條數(shù)據(jù)插入模態(tài)框的實(shí)現(xiàn)代碼
這篇文章主要介紹了使用jQuery將多條數(shù)據(jù)插入模態(tài)框的方法,很簡單,很實(shí)用,需要的朋友可以參考下2014-10-10ASP.NET jQuery 實(shí)例14 在ASP.NET form中校驗時間范圍
這節(jié)主要講如何用jQuery校驗表單時間范圍,時間控件用到了jQuery-ui2012-02-02javascript與jquery中跳出循環(huán)的區(qū)別總結(jié)
本文是對javascript與jquery中跳出循環(huán)的區(qū)別進(jìn)行了詳細(xì)的總結(jié)介紹,需要的朋友可以過來參考下,希望對大家有所幫助2013-11-11