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 | 31 |
Tags
- 이클립스
- 컬럼명
- 자바
- 자바스크립트
- Bootstrap
- 웹 서비스
- WebView
- javascript
- Web Service
- Maven
- Apache Lucene
- C#
- Eclipse
- Redirect
- MANTIS
- decompiler
- MS-SQL
- Android
- jsp
- Java
- MSsql
- varags
- 안드로이드
- STS
- 웹뷰
- scrollView
- TextBox
- asp.net
- SpringSource Tool Suite
- html
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?