Server IP : 213.176.29.180  /  Your IP : 18.191.14.62
Web Server : Apache
System : Linux 213.176.29.180.hostiran.name 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
User : webtaragh ( 1001)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/webtaragh/public_html/whmcs/assets/js/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/webtaragh/public_html/whmcs/assets/js/CreditCardValidation.js
jQuery(document).ready(function() {

    var cvvname = "";
    if (jQuery("#cccvv").length) {
        cvvname = "#cccvv";
    } else {
        cvvname = "#cardcvv";
    }

    function isAmex()
    {
        // Check if AMEX was selected from the dropdown.
        var cc = jQuery("#cctype").val();
        var ccInfo = jQuery("[name='ccinfo']:checked").val();
        if (cc.toLowerCase().indexOf("american express") !== -1) {
            return true;
        }
        if (typeof ccInfo != 'undefined') {
            return (ccInfo.toLowerCase() == 'useexisting');
        }
        return false;
    }

    function isCardTypeVisible()
    {
        return jQuery("#ccTypeButton:visible").length > 0;
    }

    jQuery(cvvname).focus(function() {
        if (isAmex() || !isCardTypeVisible()) {
            jQuery(cvvname).attr("maxlength", "4");
        } else {
            jQuery(cvvname).attr("maxlength", "3");
        }
    });

    jQuery("#cctype").change(function() {
        var cardcvv = jQuery(cvvname).val();
        if (!isAmex() && cardcvv.length > 3) {
            // Reset the CVV, since it's too long now.
            jQuery(cvvname).val("");
        } 
    });
});