Foros del Web » Programando para Internet » Jquery »

validar mail jquery problema

Estas en el tema de validar mail jquery problema en el foro de Jquery en Foros del Web. bueno amigos...no logro hacer ufuncionar la validacion del mail estoy ocupando este codigo: @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código HTML: Ver original < script language = "javascript" type ...
  #1 (permalink)  
Antiguo 12/12/2011, 19:03
 
Fecha de Ingreso: noviembre-2010
Mensajes: 208
Antigüedad: 13 años, 5 meses
Puntos: 3
validar mail jquery problema

bueno amigos...no logro hacer ufuncionar la validacion del mail

estoy ocupando este codigo:

Código HTML:
Ver original
  1. <script language="javascript" type="text/javascript" src="jquery-1.7.1.js"></script>
  2. <script language="javascript" type="text/javascript">
  3. $("#formulario").submit(function () {  
  4.     if($("#email").val().indexOf('@', 0) == -1 || $("#email").val().indexOf('.', 0) == -1) {  
  5.         alert("La dirección e-mail parece incorrecta");  
  6.         return false;  
  7.     }  
  8.     return false;  
  9. });  
  10.  
  11. </head>
  12.  
  13.  
  14. <form id="formulario" name="formulario" method="post" action="">
  15.   nombre
  16.   <label>
  17.   <input type="text" name="nombre" id="nombre" />
  18.   </label>
  19.   <p>email
  20.     <label>email
  21.     <input type="text" name="email" id="email" />
  22.     </label>
  23.   </p>
  24.   <label>web
  25.   <input type="text" name="titulo" id="titulo" />
  26.     <br />
  27.     <br />
  28.     </label>
  29.    
  30.     <input type="submit" value="GUARDAR" />
  31.    
  32. </form>

que estoy haciendo mal?
  #2 (permalink)  
Antiguo 12/12/2011, 19:14
Avatar de chicohot20  
Fecha de Ingreso: mayo-2009
Mensajes: 388
Antigüedad: 14 años, 11 meses
Puntos: 43
Respuesta: validar mail jquery problema

Creo que sería asi:
Código Javascript:
Ver original
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4. <title></title>
  5. <meta name="" content="">
  6. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  7. <script language="javascript" type="text/javascript">
  8. $(function(){
  9.     $("#formulario").submit(function () {  
  10.         if($("#email").val().indexOf('@', 0) == -1 || $("#email").val().indexOf('.', 0) == -1) {  
  11.             alert("La dirección e-mail parece incorrecta");  
  12.             return false;  
  13.         }  
  14.         return false;  
  15.     });  
  16.  });
  17. </script>
  18. </head>
  19. <body>
  20. <form id="formulario" name="formulario" method="post" action="">
  21.   nombre
  22.   <label>
  23.   <input type="text" name="nombre" id="nombre" />
  24.   </label>
  25.   <p>email
  26.     <label>email
  27.     <input type="text" name="email" id="email" />
  28.     </label>
  29.   </p>
  30.   <label>web
  31.   <input type="text" name="titulo" id="titulo" />
  32.     <br />
  33.     <br />
  34.     </label>
  35.    
  36.     <input type="submit" value="GUARDAR" />
  37.    
  38. </form>
  39. </body>
  40. </html>
  #3 (permalink)  
Antiguo 12/12/2011, 19:18
 
Fecha de Ingreso: noviembre-2010
Mensajes: 208
Antigüedad: 13 años, 5 meses
Puntos: 3
Respuesta: validar mail jquery problema

no creo ke es lo mesmo!!
  #4 (permalink)  
Antiguo 12/12/2011, 19:19
Avatar de chicohot20  
Fecha de Ingreso: mayo-2009
Mensajes: 388
Antigüedad: 14 años, 11 meses
Puntos: 43
Respuesta: validar mail jquery problema

Haz probado?
  #5 (permalink)  
Antiguo 12/12/2011, 19:30
 
Fecha de Ingreso: noviembre-2010
Mensajes: 208
Antigüedad: 13 años, 5 meses
Puntos: 3
Respuesta: validar mail jquery problema

ASI ES LO PROBE....ESTA PARTE DE TU CODIGO ES LO MESMO A LA QUE YO UTILIZO

https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
  #6 (permalink)  
Antiguo 12/12/2011, 19:40
Avatar de chicohot20  
Fecha de Ingreso: mayo-2009
Mensajes: 388
Antigüedad: 14 años, 11 meses
Puntos: 43
Respuesta: validar mail jquery problema

No entiendo tu problema, revisa esto:

http://jsfiddle.net/chicohot20/RWdac/
  #7 (permalink)  
Antiguo 12/12/2011, 20:03
 
Fecha de Ingreso: noviembre-2010
Mensajes: 208
Antigüedad: 13 años, 5 meses
Puntos: 3
Respuesta: validar mail jquery problema

ahy si..ahora lo probe y me funciono.....ahora como coloco el mensaje de mail incorrecto inmediatamente al colocarlo o por ejemplo al precionar tabuador...me salga el mensaje y no me deje avanzar a otro input mientras coloke una direccion de correo electronica valida....en otro ejemplo utilize algo asi ..pero ahora no me resulto

Código Javascript:
Ver original
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4. <title></title>
  5. <meta name="" content="">
  6. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  7. <script language="javascript" type="text/javascript">
  8. $(function(){
  9.     $("#formulario").submit(function () {  
  10.         if($("#email").val().indexOf('@', 0) == -1 || $("#email").val().indexOf('.', 0) == -1) {  
  11.             alert("La dirección e-mail parece incorrecta");  window.document.formulario.email.focus();     
  12.                 window.document.formulario.email.select();
  13.              
  14.         }  
  15.         return false;  
  16.     });  
  17.  });
  18. </script>
  19. </head>
  20. <body>
  21. <form id="formulario" name="formulario" method="post" action="">
  22.   nombre
  23.   <label>
  24.   <input type="text" name="nombre" id="nombre" />
  25.   </label>
  26.   <p>email
  27.     <label>email
  28.     <input type="text" name="email" id="email" />
  29.     </label>
  30.   </p>
  31.   <label>web
  32.   <input type="text" name="titulo" id="titulo" />
  33.     <br />
  34.     <br />
  35.     </label>
  36.    
  37.     <input type="submit" value="GUARDAR" />
  38.    
  39. </form>
  40. </body>
  41. </html>

Etiquetas: formulario, funcion, javascript, js, mail
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:30.