更新时间:2023-02-21 11:46:43
使用javascript执行此操作的唯一方法是使用模式
属性。
但这限制了浏览器支持。
HTML输入模式属性 [ ^ ]
Alphas只会看起来像这样:
The only way to do this with out javascript is using thePattern
attribute.
But this has limited browser support.
HTML input pattern Attribute[^]
Alphas only would look something like this:
<input type="text" pattern="[A-Za-z\\s]*" />
除非你对使用的浏览器有100%的控制权,否则我强烈建议你为此开发一个Javascript方法。
Unless you have 100% control over the browser being used I strongly suggest you develop a Javascript method for this.
检查出来:正则表达式(正则表达式)接受只有ASP.Net中TextBox中的字母和空格 [ ^ ]