Easy Tutorial
❮ Prop Video Mediagroup Prop Style Backgroundcolor ❯

Input Email pattern Attribute

Input Email Object

Example

Retrieve the value of the pattern attribute for the email field:

var x = document.getElementById("myEmail").pattern;

x output result:

[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$

Definition and Usage

The pattern attribute is used to set or return the value of the pattern attribute for the email field.

The pattern attribute describes a regular expression used to validate the value of the email field.

Tip: Use the global HTML title attribute or the DOM title property to help users describe the pattern.

Tip: Learn about Regular Expressions in our JavaScript tutorial.

Tip: Also, check out our JavaScript Regular Expression Reference.


Browser Support

Internet Explorer 10, Firefox, Opera, and Chrome support the pattern attribute.

Note: Internet Explorer 9 and earlier versions, and Safari do not support the pattern attribute.

Note: Internet Explorer 9 and earlier versions, and Safari do not support the <input type="email"> element.


Syntax

Return the pattern attribute:

Set the pattern attribute:

Attribute Values

Value Description
regexp Describes the regular expression to validate the email field

Technical Details

| Return Value: | String, representing a regular expression | | --- | --- |


Related Pages

HTML Reference: HTML <input> pattern Attribute


Input Email Object

❮ Prop Video Mediagroup Prop Style Backgroundcolor ❯