Angular JS Questions and Answers Angular JS is an open-source Java Script framework developed by Google to build single-page applications using HTML, CSS, and Java Script.This book has been written with the intent of preparing yourself for Angular JS interview with solid foundations on Angular JS – in a short time.This method accepts regex expressions as arguments to check the string and returns the position of the specified value in the string or a -1 if no match was found.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.Nothing exciting here except in line 6 where the on Click event is triggered when the user clicks on the button.This event will launch the verify Email() Java Script function which will check the user input of the email address.Java script can check the regular expression pattern for valid email address.
Form validation normally used to occur at the server, after the client had entered all the necessary data and then pressed the Submit button.
This Java Script demo verifies that an email address is in the correct format and that the user has typed in the same address in both fields to prevent mistyping of the address.
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.
An alert tells the user that he or she has done a good job and the function returns a true value so that you can continue with the form submission.
Ideally, you would have this function run during the on Submit attribute for the form tag.
I would like to have feedback from my blog readers.