I'm trying to create a sign up form which is only open to students currently studying at a UK university, so need to ensure the email address they enter ends in .ac.uk.
I have the following JS function but it's not working at all.
function valUniEmail()
{
var email = document.getElementById('contactFormEmail');
if (email.innerHTML.match(^[\w!#$%&'*+/=?^`{|}~-]+(?:\.[\w!#$%&'*+/=?`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+(?:\.ac\.uk)$`)
{
document.getElementById('tick').style.display = 'display;'
}
else
{
document.getElementById('cross').style.display = 'none;'
}
}
Any ideas why this might not be working?
Thanks