Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda