Created
May 23, 2018 09:17
-
-
Save morozVA/cc7bfbf3a2031624476fbb8da4aef23b to your computer and use it in GitHub Desktop.
js запретить печатать кириллицу в input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Latin(obj) { | |
if (/^[a-zA-Z0-9 ,.\-:"()]*?$/.test(obj.value)) | |
obj.defaultValue = obj.value; | |
else | |
obj.value = obj.defaultValue; | |
} | |
<input onkeyup="Latin(this);"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment