Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

157
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda