IBAN verification code
-
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
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘IBAN verification code’ is closed to new replies.