How to validate GSTIN Number using Jquery

Format of GSTIN

The First 2 digits of this number will represent the state code as per Indian Census 2011

The next 10 digits will be the PAN number of the taxpayer

The 13 digit will be assigned based on the number of registration within a state

The 14 digit will be Z by default

The last digit will be for check code. It may be an alphabet or a number.

Following Jquery Code to Validate Goods and Services Taxpayer Identification Number (GSTIN)

<script src=""></script>
  $(document).on('change',".gstinnumber", function(){    
    var inputvalues = $(this).val();
    var gstinformat = new RegExp('^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$');
    if (gstinformat.test(inputvalues)) {
     return true;
    } else {
        alert('Please Enter Valid GSTIN Number');

Let apply the above Jquery function in an HTML form.

<form method="get" name="form1">
<input type="text" name="text1" class="gstinnumber">
<input type="submit">


You May Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *