Jquery Validate 預設校驗規則及常用的自定義驗證規則
阿新 • • 發佈:2019-01-05
二、預設校驗規則
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
(1)、required: true 必輸欄位
(2)、remote: "remote-valid.jsp" 使用ajax方法呼叫remote-valid.jsp驗證輸入值
(3)、email: true 必須輸入正確格式的電子郵件
(4)、url: true 必須輸入正確格式的網址 (5)、date: true 必須輸入正確格式的日期,日期校驗ie6出錯,慎用
(6)、dateISO: true 必須輸入正確格式的日期(ISO),例如:2009-06-23,1998/01/22
只驗證格式,不驗證有效性
(7)、number: true 必須輸入合法的數字(負數,小數)
(8)、digits: true 必須輸入整數
(9)、creditcard: true 必須輸入合法的信用卡號
(10)、equalTo: "#password" 輸入值必須和#password相同
(11)、accept:
輸入擁有合法字尾名的字串(上傳檔案的字尾)
(12)、maxlength:5
輸入長度最多是5的字串(漢字算一個字元)
(13)、minlength:10
輸入長度最小是10的字串(漢字算一個字元)
(14)、rangelength:[5,10]
輸入長度必須介於 5 和 10 之間的字串")(漢字算一個字元)
(15)、range:[5,10]
輸入值必須介於 5 和 10 之間 (16)、max:5
輸入值不能大於5
(17)、min:10
輸入值不能小於10
|
三、預設的提示
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |