I want to validate the textbox which should accept only "letters" and "." and "/".
how to do this using jquery plugin?
thanks in ad开发者_如何学Govance.jquery vlidt
You will need to extend the validation plugin to use a regular expression as discussed in this post here: StackOverflow
$.validator.addMethod(
"regex",
function(value, element, regexp) {
var check = false;
var re = new RegExp(regexp);
return this.optional(element) || re.test(value);
},
"Please check your input."
);
$("Textbox").rules("add", { regex: "^[a-zA-Z./]+" }) - I think this reg expression is right...?
And for your specific example, a list of regular expressions can be found here
精彩评论