HTML CSS Javascript jQuery AJAX PHP Java MORE
Need a Website Or Web Application Contact : +91 9437911966 (Whatsapp) Note: Paid Service

How to validate PAN number using Javascript

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
    .PAN
    {
        text-transform: uppercase;
    }
    .error
    {
        color: Red;
        visibility: hidden;
    }
</style>
<script type="text/javascript">
    function ValidatePAN() {
        var txtPANCard = document.getElementById("txtPANCard");
        var lblPANCard = document.getElementById("lblPANCard")
        var regex = /([A-Z]){5}([0-9]){4}([A-Z]){1}$/;
        if (regex.test(txtPANCard.value.toUpperCase())) {
            lblPANCard.style.visibility = "hidden";
            return true;
        } else {
            lblPANCard.style.visibility = "visible";
            return false;
        }
    }
</script>
</head>
<body>

PAN Card:
<input name="txtPANCard" type="text" id="txtPANCard" class="PAN" />
<span id="lblPANCard" class="error">Invalid PAN Number</span>
<br>
<input type="button" id="btnSubmit" value="Submit" onclick="ValidatePAN()" />

</body>
</html>