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 />
確認密碼:<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擴展插件Validate—4設(shè)置錯誤提示的樣式
- JQuery擴展插件Validate—6 radio、checkbox、select的驗證
- JQuery擴展插件Validate 5添加自定義驗證方法
- jValidate 基于jQuery的表單驗證插件
- jQuery驗證插件validate使用方法詳解
- jQuery插件Validate實現(xiàn)自定義校驗結(jié)果樣式
- jQuery插件Validate實現(xiàn)自定義表單驗證
- Jquery插件 easyUI屬性匯總
- Jquery插件之多圖片異步上傳
- jQuery Dialog 彈出層對話框插件
- 強烈推薦240多個jQuery插件提供下載
- 分享20多個很棒的jQuery 文件上傳插件或教程
- jQuery validate插件功能與用法詳解
相關(guān)文章
基于jquery的自定義鼠標提示效果 jquery.toolTip
看到其它網(wǎng)站A標簽title效果,心里癢癢,就想也用到自己網(wǎng)站上。 正好在學(xué)jquery 插件擴展,就參照前輩代碼,自己動手寫了一個2010-11-11
jQuery操作input type=radio的實現(xiàn)代碼
jQuery操作input type=radio的實現(xiàn)代碼,需要的朋友可以參考下2012-06-06
jquery獲取并修改觸發(fā)事件的DOM元素示例【基于target 屬性】
這篇文章主要介紹了jquery獲取并修改觸發(fā)事件的DOM元素,結(jié)合實例形式分析了jQuery基于target 屬性獲取到觸發(fā)該事件的dom并修改的相關(guān)操作技巧,需要的朋友可以參考下2019-10-10
jquery插件開發(fā)之實現(xiàn)jquery手風琴功能分享
需要一個手風琴效果,就動手寫了一個。其實有多個現(xiàn)成的jQuery手風琴插件可以用,但對比了一下,總感覺有些笨重,還是自己寫的脈絡(luò)自己最清楚,擴展起來也更容易些2014-03-03

