久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线
Discuz! 官方交流社區
標題:
通用表單驗證組件Validform
[打印本頁]
作者:
我是小站長
時間:
2019-6-1 20:06
標題:
通用表單驗證組件Validform
Validform是表單驗證的一個解決方案,它可以讓你不用考慮表單的驗證邏輯和元素之間的依賴關系而只需專注于單個元素的驗證規則,而且單個元素的驗證它也已提供了常用的驗證規則,這些規則它還允許你邏輯組合著使用,默認提供的規則不夠用時還能很方便的擴展添加自定義的規則,驗證的各種狀態,如出錯、成功等都能由自己決定怎么顯示,所以,當你使用Validform做表單驗證,要做的就只是給元素指定規則而已了!
Validform使用入門
1、引入Validform.css
<link type="text/css" href="Validform.css"></script>
復制代碼
2、引入js (jquery 1.4.3 以上版本都可以)
<script type="text/javascript" src="jquery-1.4.3.min.js"></script>
<script type="text/javascript" src="Validform_v6.0.0-min.js"></script>
復制代碼
3、給需要驗證的表單元素綁定附加屬性
<form class="demoform" >
<input type="text" value="" name="name" datatype="s5-16" errormsg="昵稱至少5個字符,最多16個字符!" />
</form>
復制代碼
4、初始化,就這么簡單
new Validform();
復制代碼
演示及下載:
http://validform.rjboy.cn/demo.html
歡迎光臨 Discuz! 官方交流社區 (http://www.9999xn.com/)
Powered by Discuz! W1.0