IBAN verification code | WordPress.org

[ad_1]

hello I am trying to write an IBAN validation form. The code below is working correctly.

The problem is to delete spaces defined in fieldname27. For some reason the js function does not work.. but it works in html.

    function validateIBAN() {
      var iban = document.getElementById("fieldname27").value.replace(/[^a-zA-Z0-9]/g, '').toUpperCase();

      var ibanPattern = /^[A-Z]{2}\d{2}[A-Z0-9]{4}[0-9]{7}([A-Z0-9]?){0,16}$/;

      if (ibanPattern.test(iban)) {
        var countryCode = iban.substring(0, 2);
        var checkDigits = iban.substring(2, 4);
        var bban = iban.substring(4);
        var numericIBAN = bban + countryCode + checkDigits;

        var numericValue = "";
        for (var i = 0; i < numericIBAN.length; i++) {
          var charValue = numericIBAN[i].toUpperCase().charCodeAt(0) - 55;
          if (charValue >= 10 && charValue <= 35) {
            numericValue += charValue;
          } else {
            numericValue += numericIBAN[i];
          }
        }

        var mod97 = BigInt(numericValue) % 97n;

        if (mod97 === 1n) {
          document.getElementById("result").innerHTML = "IBAN geçerli.";
        } else {
          document.getElementById("result").innerHTML = "IBAN geçerli değil.";
        }
      } else {
        document.getElementById("result").innerHTML = "Geçerli bir IBAN girin.";
      }
    }

But after I check the result, I want to print it like this.

    jQuery('#calculation-result').html(result);
    jQuery('.kriter1-aciklama').html('Sonuç :');
    jQuery('.kriter1-sonuc').html(result);

I wonder how can I run this query correctly?
Thanks

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer