|
|
Allow only alphabets for textbox - Javascript
|
Views : 2704
|
|
Tagged in : Javascript
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Allow only alphabets
Use the below code to allow only alphabets in your textbox.
<html>
<head>
<script type = "text/javascript">
function AllowAlphabet(){
if (!TEST.TESTER.value.match(/^[a-zA-Z]+$/) && TEST.TESTER.value !="")
{
TEST.TESTER.value="";
TEST.TESTER.focus();
alert("Please Enter only alphabets in text");
}
}
</script>
</head>
<body>
<form name="TEST">
<input type="text" name="TESTER" onkeyup="AllowAlphabet()">
</form>
</body>
</html> |
|
By Nirmala, On - 2010-04-08 |
|
|
|