jQuery validate plugin : accept letters only?

后端 未结 8 1375
被撕碎了的回忆
被撕碎了的回忆 2020-11-29 07:23

I\'m using the validate plugin from http://bassistance.de/jquery-plugins/jquery-plugin-validation/

What i\'m trying to find is a way to make some of my form fields a

8条回答
  •  無奈伤痛
    2020-11-29 07:55

    Try like this:

            var numbers = /[0-9]+/;
            var SpCharacters = /^\s*[a-zA-Z0-9\s]+\s*$/;
    
            if (!numbers.test(name) && !SpCharacters.test(name)) {
                return [false, "Name should be alphabetical.", ""];
            }
    

提交回复
热议问题