Help with Jquery and Regex
Hi, I have just started with jquery and love it. But now been having some problems with how to create a macro that would let me create a text box, tell the maximum size of the text box and what kind of regrex to put in. I want to just be able to have variables to pass so I the user can have more choices.
I found this example:
$("Textbox").rules("add", { regex: "^[a-zA-Z'.\s]{1,40}$" })
$.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."
);
Thank you so much for any advice you can give.