Comment passer regex personnalisé dans la validation jQuery
$("#Textbox").rules("add", { regex: "^[a-zA-Z'.\\s]{1,40}$" })
Hurt Hamerkop
$("#Textbox").rules("add", { regex: "^[a-zA-Z'.\\s]{1,40}$" })
$.validator.addMethod(
"regex",
function(value, element, regexp) {
var re = new RegExp(regexp);
return this.optional(element) || re.test(value);
},
"Please check your input."
);