Validating an email address in javascript


If the search() method returns a -1, then an alert would tell the user that an invalid email address has been entered and returns a false value.Description: A script that closely examines the content of a form box to ensure that the user entered a valid email address.Example: Directions: Simply cut and paste the below code into the section of your page.

validating an email address in javascript-44

I have borrowed the regex for verifying the correct email format from a different site. Please note that I have removed the action attribute because this is only a demo and we are only concerned with the client-side verification of the Java Script function.

Nothing exciting here except in line 6 where the on Click event is triggered when the user clicks on the button.

Simply, quickly and effectively use j Query to validate and verify email addresses.

Stop bad email addresses before they get into your system. Let's face it, validating, verifying and checking input data is not what is generally described as a "fun" activity if you're a web developer.

To validate email address on client side, we can use java script with regular expression.