From the course: Validating and Processing Forms with JavaScript and PHP

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Using the jQuery Validation plugin

Using the jQuery Validation plugin

One of the common ways to add functionality to jQuery is by using plugins. They are additional Javascript files which expand the library. One of the oldest plugins available for jQuery happens to be a form validation plugin. If you're already using jQuery on your page, this might be a really quick solution for you since it's fairly easy to set up. You could download the plugin from the jQuery validation page. To install it just like with any other script, you create a script tag with the URL of the library as the source. We're going to go ahead and add it from a content delivery network, so that we don't have to download the script. I'm going to go to cdnjs.com and I'll do a search for validate. You can see the jQuery validate library right here. So I'm going to copy this URL, and go back into my form and I'll paste it right after the jQuery code. Now I'm going to add the HTTP colon right here. Notice some problems if I don't add the HTTP colon to this link. Now adding validation to…

Contents