文本框只能输入字母。 [英] textbox to enter only alphabets.
本文介绍了文本框只能输入字母。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的所有人,
我有一个文本框,用户必须只输入字母到该文本框中。
请为此我需要JavaScript。
谢谢先生。
Dear All,
I have a Textbox, user must enter only alphabets into that textbox.
Please I need JavaScript for this.
Thank you sir.
推荐答案
Google是一个了不起的工具。但只有你真的懒得使用它...
Google [ ^ ]
热门:如何限制用户在asp.net中通过javascript仅在TextBox中输入alphabates [ ^ ]
将来,请尝试自己做至少基础研究,不要浪费你的时间或我们的时间。
Google is a marvellous tool. But only if you actually bother to use it...
Google[^]
Top hit: How to Restrict user to enter only alphabates in TextBox by javascript in asp.net[^]
In future, please try to do at least basic research yourself, and not waste your time or ours.
有办法让这种情况发生,使用常规表达式,JavaScript验证等。
我更喜欢Masked Textbox
,例如:增强的文本框控件 [ ^ ]
There are ways to make this happen, using regular expression, JavaScript validation, etc.
I would preferMasked Textbox
for it, something like: Enhanced Textbox Control[^]
var value = "a";
var reg = new RegExp("[A-Za-z]");
if (!reg.test(value)) {
return false;
}
尝试这个。
谢谢,
Mamun
try with this.
Thanks,
Mamun
这篇关于文本框只能输入字母。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文