JavaScript alphabets validation

Letters or alphabets only validation in JavaScript is used to make sure that all the characters entered in the specified field must be any character from A-Z or a-z.

Regular Expression:



<!DOCTYPE html>
<html lang="en">
function lettersOnlyCheck(name)
   var regEx = /^[A-Za-z]+$/;
      return true;
     alert("Please enter letters only.");
     return false;
<div class="mail">
<h2>JavaScript Letters Only Validation</h2>
<form name="form1" action="#"> 
Name: <input type='text' name='name'/></br></br>
<input type="submit" name="submit" value="Submit" onclick="lettersOnlyCheck("/>
Please Share