Form Validation and Jquery

Form Validation, jQuery

Form Validation

JavaScripts provides a way to validate form data on the client’s computer before sending it to the webserver. Form validation generally performs two functions.

  1. Basic Validation: First of all, the form must be checked to make sure all the mandatory fields are filled in. We call validate() function to validate data when onsubmit event occurs.
  2. Date Format Validation: Secondly, the data that is entered must be checked for correct form and value. The code must include appropriate logic to test the correctness of data.

jQuery

jQuery is a lightweight, fast, and feature-rich JavaScript library. The purpose behind using jQuery is to make it much easier to use javascript in the websites. It reduces the development time, easy to add animation and event handling programs.

Using jQuery

There are several ways to start using jQuery on the website. We can:

  • Download the jQuery library from jQuery.com. Place the downloaded file in the same directory as the web pages and embed it with web pages as follows:
<head>  
<script src="jquery-3.5.1.min.js">  
</script>  
</head>
  • Include jQuery from a CDN (Content Delivery Network), like Google:
<head>  
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js">  
</script>  
</head>