Last active
June 28, 2022 12:12
-
-
Save SathishSaminathan/e3c509243ead20fcae26c87fdd6f78fd to your computer and use it in GitHub Desktop.
Allow only the Alphabets inside the Textbox javascript (Exception:BackSpace),allow only alphabets inside textbox,how to validate textbox to accept only characters,allowing only alphabets in text box using java script
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
<html> | |
<head> | |
<script> | |
function myf(e) | |
{ | |
var c=((e.which>=65 && e.which<91)||(e.which==8)) | |
{ | |
document.getElementById("error").style.display=c?"none":"inline" | |
} | |
return c; | |
} | |
</script> | |
</head> | |
<body> | |
<input type="text" id="txt" onkeydown="return myf(event)"><span id="error" style="color:red;display:none">Plese Enter Only Alphabets...</span> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment