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