Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
Allow edu domain emails in form jquery

I tried various solutions but it didn't work. Not that good with JavaScript especially with RegEx. Found this solution online, but couldn't modify it.

Basically I need to allow EDU domain in email field. I think it would be @ohio.edu or @ohio.edu.com or something like that. How can I say that if there isn't phrase "edu" after @, then don't allow the registration?

$(".single-memberpressproduct.postid-1945 .mepr-submit").click(function() {
  validateEmail(jQuery("input#user_email1").val());
  return false;
});

function validateEmail(email) {
  var emailRegx = /b(?:(?![_.-])(?!.*[_.-]{2})[a-z0-9_.-]+(?<![_.-]))@(?:(?!-)(?!.*--)[a-z0-9-]+(?<!-).)*.edub/i;
  if (emailRegx.test(email)) {
    if (email.indexOf('@edu.com', email.length - '@edu.com'.length) !== -1) {
      alert('Submission was successful.');
    } else {
      alert('Not a valid e-mail address @.');
    }
  } else {
    alert('Not a valid e-mail address.');
  }
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<form class="single-memberpressproduct postid-1945">
  <input type="text" id="user_email1" value="" />
  <input type="submit"  class="mepr-submit" />
</form>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I ended up using different approach.

<script>
jQuery('.single-memberpressproduct.postid-1945 .mepr-submit').attr("disabled", "disabled"); 
var youtubeRegex = /edu/i;
jQuery('input#user_email1').keyup(function(){
    jQuery(".single-memberpressproduct.postid-1945 .mepr-submit").attr("disabled", !youtubeRegex.test(this.value));
});
</script>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!