1 jQuery Fan Blog for your Daily News, Plugins, Tuts/Tips & Code Snippets.
This tutorial shows you how to set up a basic form validation with jQuery, demonstrated by a registration form.
First, we need to include the jQuery library. The jQuery validation plugin has been tested up to jQuery version 3.1.1, but the demo in this article works perfectly with version 3.4.1, which is the latest one.
You can use any of the following download options:
$ bower install jquery
$ npm install jqueryor
yarn add jquery
Create a new HTML file named
index.html and include jQuery before the closing
<!-- Change the "src" attribute according to your installation path --> <script src="vendor/jquery/dist/jquery.min.js"></script>
If you’d like to use Bower or npm but aren’t familiar with them, you might be interested in these two articles:
$ bower install jquery-validation
npm i jquery-validation
Include the plugin after jQuery:
<!-- Change the "src" attribute according to your installation path --> <script src="vendor/jquery-validation/dist/jquery.validate.min.js"></script>
The post How to Set Up Basic jQuery Form Validation in Two Minutes appeared first on SitePoint.