Input Email pattern Attribute
Definition and Usage
pattern
attribute sets or returns the value of the pattern attribute of the email field.
HTML pattern attribute specifies a regular expression to check the value of the email field.
Tip:Please use the global HTML title attribute or DOM title attributes to describe the pattern to help users.
Tip:Learn more aboutRegular Expressionknowledge.
Tip:See also our complete JavaScript RegExp Reference.
See also:
HTML Reference Manual:HTML <input> pattern Attribute
Example
Get the pattern attribute value of the email field:
var x = document.getElementById("myEmail").pattern;
Syntax
Return the pattern attribute:
emailObject.pattern
Set the pattern attribute:
emailObject.pattern = regexp
attribute value
value | description |
---|---|
regexp | Specifies the regular expression for checking the email field value. |
Technical Details
Return Value: | A string value that represents the regular expression. |
---|
Browser Support
The numbers in the table indicate the first browser version that fully supports the attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |