THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Input Email pattern Property

Input Email Object Reference Input Email Object

Example

Get the value of the pattern attribute of an email field:

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

The result of x will be:

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

Definition and Usage

The pattern property sets or returns the value of the pattern attribute of an email field.

The pattern attribute specifies a regular expression that the email field's value is checked against.

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

Tip: Learn more about Regular Expressions in our JavaScript Tutorial.

Tip: Also see our Complete JavaScript RegExp Reference.


Browser Support

Property
pattern Yes 10.0 Yes Yes Yes

Syntax

Return the pattern property:

emailObject.pattern

Set the pattern property:

emailObject.pattern=regexp

Property Values

Value Description
regexp Specifies a regular expression that the email field's value is checked against

Technical Details

Return Value: A String, representing a regular expression

Related Pages

HTML reference: HTML <input> pattern attribute


Input Email Object Reference Input Email Object