Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Client side validation using regular expression
Play lesson

JavaScript Tutorial - Client side validation using regular expression

4.0 (0)
13 learners

What you'll learn

This course includes

  • 12.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

Link for all dot net and sql server video tutorial playlists http://www.youtube.com/user/kudvenkat/playlists Link for slides, code samples and text version of the video http://csharp-video-tutorials.blogspot.com/2015/01/client-side-validation-using-regular.html Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help. https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation=1 In this video we will discuss, how regular expressions can be used to perform client side validation. On most of the websites it is common to check if the format of the email is valid. Using regular expressions we can achieve this very easily. Here is an example. Email : [input type="text" id="txtEmail" onkeyup="validateEmail()" /] [script type="text/javascript"] function validateEmail() { var emailTextBox = document.getElementById("txtEmail"); var email = emailTextBox.value; var emailRegEx = /^(([^[]()[\]\\.,;:\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,}))$/; emailTextBox.style.color = "white"; if (emailRegEx.test(email)) { emailTextBox.style.backgroundColor = "green"; } else { emailTextBox.style.backgroundColor = "red"; } } [/script]

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere