Hi,
I’m afraid i am not very good with JS so i am hoping that someone can help. I’ve copied a website (with permission) and it uses some JS for checking the email address as follows
'email': function() {
var ele = $('#email');
var label = $('#em-label');
var patt = /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$/;
if (!patt.test(ele.val())) {
jVal.errors = true;
label.addClass('err');
} else {
label.removeClass('err');
}
If i enter my email address with a capital letter it doesn’t allow the form to be submitted and simply just displays a red border. I think this would confuse a lot of users as there is nothing to say it is because there is a capital letter.
I am assuming the ‘patt’ variable is saying only allow certain characters and from what i can see they are a-z in lower case. Is there a way of saying don’t worry about case. Or do i need to add in the uppercase A-Z.
Stabbing in the dark would this work-
var patt = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
any help appreciated