Hello! I am trying to figure out how to block form submissions from nonbusiness emails ( EX: @gmail.com, @aol.com, etc.). I was able to find an article on here that led me to this code
<script type="text/javascript">
$(document).ready(function(e) {
$('#submit-button-id').click(function() {
var email = $('#email-3').val();
var reg = /^([\w-\.]+@(?!gmail.com)(?!yahoo.com)(?!hotmail.com)(?!yahoo.co.in)(?!aol.com)(?!abc.com)(?!xyz.com)(?!pqr.com)(?!rediffmail.com)(?!live.com)(?!outlook.com)(?!me.com)(?!msn.com)(?!ymail.com)([\w-]+\.)+[\w-]{2,4})?$/;
if (reg.test(email)) {
return 0;
} else {
alert('Please Enter Business Email Address');
return false;
}
That works… kind of, it blocks EVERY email. I am about 4 years removed from my last HTML/Javascript/jquery class, so I can follow along with most of the guides I have seen but this one has me pretty stumped.
Any and all help is welcome thank you!