Get the value of the pattern attribute of an email field:
The result of x will be:
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.
The pattern property is supported in Internet Explorer 10, Firefox, Opera, and Chrome.
Note: The pattern property is not supported in Internet Explorer 9 and earlier versions, or in Safari.
Note: The <input type="email"> element is not supported in Internet Explorer 9 and earlier versions, or in Safari.
Return the pattern property:
Set the pattern property:
Value | Description |
---|---|
regexp | Specifies a regular expression that the email field's value is checked against |
Return Value: | A String, representing a regular expression |
---|
HTML reference: HTML <input> pattern attribute