Accept Only Alphabets in a Textbox

a) Performs validation for alphabets entered in the textbox.
b) If the entered value is not an alphabet, it gives an alert.
b) Simple and easy to use.

Features

  • Performs validation for alphabets entered in the textbox.
  • If the entered value is not an alphabet, it gives an alert.
  • Simple and easy to use.

Preview

Accept Only Alphabets - Textbox
Enter Text
©h

Downloads

Javascript Code


<!-- Script by hscripts.com -->
<!-- More scripts @www.hscripts.com -->
<script type="text/javascript">
function AllowAlphabet(){
if (!frm.alphabet.value.match(/^[a-zA-Z]+$/) && frm.alphabet.value !="")
{
frm.alphabet.value="";
frm.alphabet.focus();
alert("Please Enter only alphabets in text");
}
}
</script><!-- Script by hscripts.com -->

HTML Code


<table align=center>
<tr><td><form name="frm">
Enter Text: <input type="text" name="alphabet" onkeyup="AllowAlphabet()">
</form><br;>
<div align=center style="font-size: 10px; color: #dadada;" id="dumdiv">
<a href="https://www.hscripts.com" id="dum" style="text-decoration:none; color: #dadada;">©h</a>
</div>
</td></tr>
<script type="text/javascript">document.onload = ctck();</script>
</td></tr>
</table>
  • Release Date - 06-05-2010
  • Get free version without ©copyright link for just $10/-
  • For customization of this script or any script development, mail to support@hscripts.com

Usage

  • Copy and paste the javascript code into your HTML page and make use of this.
  • Here, the function "AllowAlphabet()" is used to accept only alphabets in the textbox.

License

Related Scripts

Free Javascript Scripts


Ask Questions

Ask Question