Results 1 to 4 of 4

Thread: jquery to check email

  1. #1
    Join Date
    Apr 2008
    Posts
    32

    jquery to check email

    Hi,

    I need some help to validate email field with JQuery.
    Can someone please help me out?

    Thanks

  2. #2
    Join Date
    May 2008
    Posts
    20

    Re: jquery to check email

    Plugins/Validation/Methods/email

    email( )

    Makes "field" required and an email address.

    Code:
    $("#myform").validate({
      rules: {
        field: {
          required: true,
          email: true
        }
      }
    });

  3. #3
    Join Date
    May 2008
    Posts
    44

    Re: jquery to check email

    jQuery to validate Email Address

    A program that validate the email address from server and displays on the user browser.

    Create php file to that prints the current server data. Here is the code of PHP script (emailValidation.php).

    Code:
    <?
    
    $email = $_GET['email'];
    
    
    function isValidEmail($email){
    return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email);
    }
    
    if($email=="")
    {
    $errormsg="error1";
    }
    if(!isValidEmail($email) && $email!="")
    {
    $errormsg="error2";
    }
    
    
    echo $errormsg;
    ?>
    Write HTML page to call the emailValidation.php. Create a new file (emailvalidation.html) and add the following code into it:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    <style>
    .error{
    color:red;
    }
    </style>
        <title>E-Mail Validation</title>
        <script type="text/javascript" src="jquery-1.2.6.js"></script>
            <script type="text/javascript">  
    function  emailValidate()
    {
    
      
      email = document.getElementById("email").value;
       
    
    	$.ajax({
    	url : "emailvalidation.php?email="+email,
    	success : function (data) {
    	
    	   if(data=="error1")
    		  {
    		     document.getElementById("erroremail").innerHTML=
                         "Please enter email.";
    
    		  }
    		  else if(data=="error2")
    		  {
    		     document.getElementById("erroremail").innerHTML=
                         "Please enter valid email.";
    
    		  }
    	}
    	});
    
    	
    }
     </script>  
    </head>
    <form name="emailvalidate" action="" method="post" >
    
    
        <div><input type="hidden" name="query" value="" /></div>
        <table>
    	<tr><td colspan=2>&nbsp;<div id="errormsg"></div></td></tr>
       
    	<tr>
            <th align="left"><label for="email">Email</label></th>
            <td><input type="text" id="email" name="email" size="20" />
    	
    		</td>
           	<td id="erroremail" class="error"></td>
    
        </tr>
        <tr>
            <td></td>
            <td><input type="button" name="Submit" value="Submit" 
                 onClick="emailValidate();"/></td>
    
        </tr>
        </table>
        
    
    </form>
    
    </html>

  4. #4
    Join Date
    Apr 2008
    Posts
    32

    Re: jquery to check email

    Thanks a lot for the prompt reply.

    im pretty

Similar Threads

  1. How to Check the Validity of an Email Address
    By lorelei in forum Windows Software
    Replies: 3
    Last Post: 24-04-2012, 03:17 AM
  2. Avast is not able to check email when set to ssl inside thunderbird
    By Eeshika18 in forum Networking & Security
    Replies: 6
    Last Post: 19-12-2011, 03:55 PM
  3. Replies: 4
    Last Post: 25-12-2010, 09:37 AM
  4. How to check if the email has been sent or not using asp.net?
    By KAILEY in forum Software Development
    Replies: 4
    Last Post: 26-02-2010, 09:36 PM
  5. Check email through outlook express from another computer
    By Xena in forum Technology & Internet
    Replies: 3
    Last Post: 28-05-2009, 07:28 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,717,929,031.05505 seconds with 17 queries