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="http://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 $5/-
  • 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

  • The javascript (misspelled as java script) is given under GPL License.
  • i.e. Free use for those who use it as it is.
  • Free, if your modification does not remove our copyright information and links.
  • Detailed License information can be found here.
  • You can purchase the script if your requirements does not meet GPL License terms.

Related Scripts

Free Javascript Scripts