Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- WebView
- 안드로이드
- 이클립스
- 컬럼명
- 자바
- Java
- scrollView
- Bootstrap
- C#
- asp.net
- 자바스크립트
- javascript
- Android
- decompiler
- MS-SQL
- Eclipse
- Apache Lucene
- MANTIS
- SpringSource Tool Suite
- jsp
- MSsql
- html
- Web Service
- Maven
- Redirect
- varags
- TextBox
- 웹뷰
- STS
- 웹 서비스
Archives
- Today
- Total
bboks.net™
jQuery Validate - custom regex 본문
Validator
jQuery.validator.addMethod(
"regex",
function(value, element, regexp) {
if (regexp.constructor != RegExp)
regexp = new RegExp(regexp);
else if (regexp.global)
regexp.lastIndex = 0;
return this.optional(element) || regexp.test(value);
}, "검증 실패 메세지");
Validate
$("#form_id").validate({
rules : {
name : { required : true },
code : {required : false, regex : "^[cC][a-zA-Z0-9]{5}$"}
},
submitHandler : submitHandler
});
[출처] JQuery validate: How to add a rule for regular expression validation?