Hello,
I am trying to build a function that takes the input of the IBAN field (alphanumeric), counts them and compares the to the needed value (24). Then, if don't match it triggers an error message, if they match it does nothing.
This is the code:
<script type="text/javascript">
function checkIBAN(iban)
{
var iban = document.getElementById('IBAN').lenght;
if (iban != 24)
{
alert('El format no és correcte');
return false;
}
else
{
return true;
}
}
</script>
This is the trigger:onblur="checkIBAN('IBAN');"
However, it is not working. I'm just learning Javascript, so it may be a silly question. Can anyone help?
Thanks!
Dani