强制用户在输入文本字段中使用英文键盘输入
我有一个输入文本字段,希望用户使用英语键盘而不是阿拉伯语等输入它。 我怎样才能在 HTML 或 Javascript 或 jquery 中做到这一点?
<input type="text" id="username" size="15">
我用这样的 lang 属性测试了它,但它不起作用:
<input type="text" id="username" size="15" lang="en">
i have an input text field and want users type it with English keyboard not with Arabic or etc.
How can i do that in HTML or Javascript or jquery?
<input type="text" id="username" size="15">
i tested it with lang attribute like this,but it didn't work:
<input type="text" id="username" size="15" lang="en">
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
纯 javascript 解决方案是:
因此 void(0) “禁用”事件,并且不会将其写入输入中。
我相信你可以编写 isEnglishKeyCode(keycode) 方法。
有关键码的帮助,您可以使用此链接或搜索。
Pure javascript solution would be:
So void(0) "disables" the event and it wont be written into the input.
I trust that u can write the isEnglishKeyCode(keycode) method.
For help on keycode u can use this link or search around.