Checking text is a letter- Using JavaScript validation statement we can check text is a letter or not.
E.g.
Check Output:
E.g.
<html>
<head>
<title>Checking Letters are entered or not</title>
</head>
<body>
Check letters are entered or not!
<form name="form1">
Enter text:<input type="text" name="txtletters">
<input type="button" onclick="check()" value="Check">
</form>
<script language="javascript">
function check()
{
x=document.form1.txtletters.value;
if(/[^a-zA-Z]/.test(x))
{
alert("Letters are not entered" + "\nIf you like this post then please \nshare it using share buttons \ngiven below")
}
else
{
alert("Letters entered" + "\nIf you like this post then please \nshare it using share buttons \ngiven below")
}
}
</script>
</body>
</html>
Related Topics:
- JavaScript Introduction
- Variables in JavaScript
- JavaScript Function
- Accessing JavaScript Function
- Creating JavaScript interactive form
- Accessing form field value
- Creating interactive form login webpage
- Networking Fundamentals
- TCP/IP and Internet addressing
- Internet Working
- Internet Working Servers
- Concept and need for web publishing
- Web languages
- Javascript Control Structure
- Checking Text is Letter/s
- Checking Text is Number/s
- Checking Textbox is Empty or not
- Addition of two numbers
- Subtraction of two numbers
- Multiplication of two numbers
- Division of two numbers
- Form field validations
- Email validation