Validate email address using .email()

.email()


Description: Simple email verification, to stop invalid email addresses.


Example:

<!doctype html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>email demo</title>
      <script src="http://code.bitsycode.com/bitsycode-latest.min.js"></script>
    </head>
    <body>
      
      <div>
        Email: <input type="text" name="myemail" class="myemail" value="" placeholder="[email protected]" />
        <span class="result"></span><br />
        <input type="button" name="submit" onclick="validate()" value="Validate" />
      </div>
     
    <script>
      
      function validate() {
          var email = bitsyCode.email(bitsyCode(".myemail").val());
          var valid = email.valid ? " Valid" : " Invalid";
          bitsyCode(".result").html("<b>" + valid + "</b>");
      }        
      
    </script>
     
    </body>
    </html>

Preview:

Email:

  • Usage

    • How to use:

      Specify the field with the email address and bitsycode will valid the email address for you.

    • USAGE:

      bitsyCode.email("[email protected]");
  • Options

    • What options are there:

      There are no options for this method.

  • Returns

    • Returns: {No return type}

      This method does not need to return any type.

      Returns: { }   // Returns an object

      Example returned object:

      Object { value: "[email protected]", valid: false }
Share