做一个输入只允许名字而不是数字 [英] Make a input only allow names and not numbers
本文介绍了做一个输入只允许名字而不是数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
personname:function(value,element){
return this.optional(element )|| /^[a-zA-Z\s]+$/.test(value);
}
但是当名称是PëterMüller或类似的东西时,它是无效的,我可以在代码中添加所有可能的字符,那些字符代码是什么?
/ ^ \D + $ / ?当所有都不是数字时它匹配。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?
解决方案
How about /^\D+$/
? It matches when all are not digits.
这篇关于做一个输入只允许名字而不是数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文