Simple jQuery Form Validator validation

Today, We want to share with you Simple jQuery Form Validator validation.In this post we will show you Form validation with jQuery Validate, hear for jquery validate form before submit we will give you demo and example for implement.In this post, we will learn about jquery form validation demo with source code with an example.

Simple jQuery Form Validator validation

There are the Following The simple About Simple jQuery Form Validator validation Full Information With Example and source code.

As I will cover this Post with live Working example to develop jquery-validation/jquery-validation, so the jquery form validation demo for this example is following below.

A simple jQuery form validation script

index.html

<h2>A simple jQuery form validation script</h2>
<form id="userFrm" method="post" action="#">
   <textarea id="mon_textarea" name="montextarea"></textarea>
   <input type="email" id="mon_email" name="useremail" />
   <input type="email" id="mon_telephone" name="telephone" />
   <input type="submit" value="ok" id="btn_submit" />
</form>

jQuery validate the form

<script>
   $(document).ready(function(){
      $("#userFrm").validate();
    });
</script>

jQuery Form Validation syntax:

jQuery(document).ready(function() {
   jQuery("#formStep").validate({
      rules: {
         "montextarea":{
            "required": true,
            "minlength": 2,
            "maxlength": 60000
         },
         "useremail": {
            "email": true,
            "maxlength": 255
         },
         "telephone": {
            "required": true
         }
  })
});

jQuery Define error errorInfos

  jQuery.extend(jQuery.validator.errorInfos, {
    required: "product errorInfo",
    remote: "product errorInfo",
    email: "product errorInfo",
    url: "product errorInfo",
    date: "product errorInfo",
    dateISO: "product errorInfo",
    number: "product errorInfo",
    digits: "product errorInfo",
    creditcard: "product errorInfo",
    equalTo: "product errorInfo",
    accept: "product errorInfo",
    maxlength: jQuery.validator.format("product errorInfo {0} caractéres."),
    minlength: jQuery.validator.format("product errorInfo {0} caractéres."),
    rangelength: jQuery.validator.format("product errorInfo  entre {0} et {1} caractéres."),
    range: jQuery.validator.format("product errorInfo  entre {0} et {1}."),
    max: jQuery.validator.format("product errorInfo  inférieur ou égal à {0}."),
    min: jQuery.validator.format("product errorInfo  supérieur ou égal à {0}.")
  });

jQuery Add Method Simple Regular Expression (regex)

jQuery.validator.addMethod(
  "regex",
   function(value, element, regexp) {
       if (regexp.constructor != RegExp)
          regexp = new RegExp(regexp);
       else if (regexp.global)
          regexp.lastIndex = 0;
          return this.optional(element) || regexp.test(value);
   },"erreur expression reguliere"
);

Phone regex

"telephone": {
    "required": true,
    "regex": /^(\+33\.|0)[0-9]{9}$/
}

jQuery Change a behaviour

rules:{
    ...
},
submitHandler: function(form)
{
    /* jQuery Form Submit Data */
    jQuery("#btn_submit").hide();
}

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Simple jQuery Form Validator validation.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.


Related FAQ

Here are some more FAQ related to this Article:

  1.   UI Grid Filtering using Angular Example
  2.   Display Uploaded Image Using Javascript Example
  3.   jquery form validation without plugin
  4.   Google Customize Timelines Charts
  5.   jQuery Form Validator Script
  6.   VueJS Filter Currency Rounding 2 decimal places Example
  7.   jQuery Remove Item From Comma Separated string
  8.   Laravel Handling findOrFail exceptions
  9.   jquery validate Form Validation
  10.   PHP Laravel 6 Change Date Format example