I was stuck with a problem to verify whether an email address has the proper format of an email address or not. I came up with an application which you could just save in your computer , open in a browser and test the string whether it is a valid email address or not.
Here is the application itself.
Validation Check
Enter an email addresses.
The code that made it possible is this one.
Here is the application itself.
Enter an email addresses.
<!DOCTYPE html> <html> <head> <title>Validation Check</title> <script type="text/javascript" > function validateRandom() { //var value = $('#emails').val();; var value = document.getElementById("emails").value; //alert(value); //var re = new RegExp("pattern"); var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; if( re.test(value) ){ alert('The text is a valid email address, in terms of its pattern'); }else{ alert('The pattern of the text do not match as a valid email address.'); } return false; } </script> </head> <body> Enter an email addresses. <form method = "post" id="email_form" > Emails:<br/> <input name="emails" id="emails" value = 'rajan'/><br/> <button type="submit" name="email_form_submit" onclick="return validateRandom()">Submit</button> </form> </body> </html>
No comments:
Post a Comment
If you like to say anything (good/bad), Please do not hesitate...