name validation using javascript

Below is the code snippet which shows the way to validate the name using javascript & regular expressions.



var letters = /^[A-Za-z ]+$/; 
   
        if(name(letters)) 
        { 
        return true; 
        } 
        else 
        { 
        alert("Please enter valid name"  ); 
        return false; 
        } 

No comments:

Post a Comment