Home >Web Front-end >HTML Tutorial ><input type="text"> 只能输入英文_html/css_WEB-ITnose

<input type="text"> 只能输入英文_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-21 08:55:021207browse

如何让  只能输入英文


回复讨论(解决方案)

JQuery 在onChange事件中判断处理

var val='汉字111';
var regName =/^[a-zA-Z]+$/;
if(regName .test(val)){alert('只能输入英文');}


onChange中,   判断是否为英文,如果不是直接返回就行。

结合2楼和3楼的就好了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn