Make a input only allow names and not numbers

2019-07-23 09:09发布

问题:

I have this:

personname: function(value, element) {
    return this.optional(element) || /^[a-zA-Z\s]+$/.test(value);
}

But when the name is Pëter Müller or something like that it is invalid, how can I add all those possible characters within my code and what are those character codes?

回答1:

How about /^\D+$/? It matches when all are not digits.