jQuery Tutorial to Validate PAN Card Number in Browser Using HTML5 & Javascript Full Project For Beginners

jQuery Tutorial to Validate PAN Card Number in Browser Using HTML5 & Javascript Full Project For Beginners

 

 

index.html

 

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Validate PAN Card Number in Javascript</title>
</head>
<body>
    PAN : <input type="text" class="pan">    
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">    
    $(document).ready(function(){     
            
    $(".pan").change(function () {      
    var inputvalues = $(this).val();      
      var regex = /[A-Z]{5}[0-9]{4}[A-Z]{1}$/;    
      if(!regex.test(inputvalues)){      
      $(".pan").val("");    
      alert("invalid PAN no");    
      return regex.test(inputvalues);    
      }    
    });      
        
    });    
    </script> 
</html>

 

 

Leave a Reply