Simple javascript textbox that accepts only alphabets to be entered.
Features
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.
Preview
Accept Only Alphabets - Textbox
Code
Javascript Code
<!-- Script by hscripts.com -->
<!-- Copyright of HIOXINDIA -->
<!-- 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 -->
For customization of this script or any script development, contact us at support@hscripts.com
Usage
a) Copy and paste the javascript code into your HTML page and make use of this.
b) 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 the codes as it is.
- Free, if your modification does not remove our copyright information and links.
- Click Here for detailed license information.
- You can purchase the script if your requirements does not meet our GPL License terms.