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