jQuery validate plugin : accept letters only?

后端 未结 8 1391
被撕碎了的回忆
被撕碎了的回忆 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 08:09

    A small change.

    jQuery.validator.addMethod("accept", function(value, element, param) {
        return value.match(new RegExp("^" + param + "$"));
    });
    

    Because that way it was accepting expressions like "#abc".

提交回复
热议问题