phpprogrammer.cn schrieb:
is there a way use jquery.validate filter special characters?

  like   some one want to input "*&^%"  as username,

 is there a way to solve it?
You can add your own validation method and apply that to your username field. Give this a try:

$.validator.addMethod("username", function(value) {
 // blacklist *, %, $ and &
 return /^[^\*&\^%]+$/g.test(value);
});

That basically blacklists *, %, $ and &. [^...]+ specifies characters that are now allowed.

Jörn

Reply via email to