Trying to do email validation but it isn't working as intended

kingawi

New Member
I'm just making some form validation with jQuery, this is the part for the email:\[code\]var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;var email = $('#user_email');$('#user_email').on('keyup change', function() { if ((email.val().length <= 6) && (re.test(email.val()))) { $('#alert_user_email').text('Email cannot be blank or invalid formation'); submit_btn.disabled = true; $('#alert_user_email').show(); } else { $('#alert_user_email').text(''); submit_btn.disabled = false; $('#alert_user_email').hide(); } });\[/code\]But for some reason it isn't working, everything works fine if I remove the \[code\]&& re.test\[/code\]stuff from the \[code\]if\[/code\] statement but isn't working as intended, any enlightenment would be great!
 
Back
Top