1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
|
<header><h1><input type="email"></h1></header><div class="section-content"><p><a href="../input"><code><input></code></a> elements of type <code>email</code> are used to let the user enter and edit an email address, or, if the <a href="../../attributes/multiple"><code>multiple</code></a> attribute is specified, a list of email addresses.</p></div>
<h2 id="try_it">Try it</h2>
<div class="section-content">
<iframe class="interactive is-tabbed-shorter-height" height="200" src="https://interactive-examples.mdn.mozilla.net/pages/tabbed/input-email.html" title="MDN Web Docs Interactive Example" loading="lazy"></iframe> <p>The input value is automatically validated to ensure that it's either empty or a properly-formatted email address (or list of addresses) before the form can be submitted. The <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:valid"><code>:valid</code></a> and <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:invalid"><code>:invalid</code></a> CSS pseudo-classes are automatically applied as appropriate to visually denote whether the current value of the field is a valid email address or not.</p>
</div>
<h2 id="value">Value</h2>
<div class="section-content">
<p>The <a href="../input"><code><input></code></a> element's <a href="../input#value"><code>value</code></a> attribute contains a string which is automatically validated as conforming to email syntax. More specifically, there are three possible value formats that will pass validation:</p> <ol> <li>An empty string ("") indicating that the user did not enter a value or that the value was removed.</li> <li>A single properly-formed email address. This doesn't necessarily mean the email address exists, but it is at least formatted correctly. In simple terms, this means <code>username@domain</code> or <code>username@domain.tld</code>. There's more to it than that, of course; see <a href="#validation">Validation</a> for a <a href="https://developer.mozilla.org/en-US/docs/Glossary/Regular_expression">regular expression</a> that matches the email address validation algorithm.</li> <li>If and only if the <a href="../input#multiple"><code>multiple</code></a> attribute is specified, the value can be a list of properly-formed comma-separated email addresses. Any trailing and leading whitespace is removed from each address in the list.</li> </ol> <p>See <a href="#validation">Validation</a> for details on how email addresses are validated to ensure that they're formatted properly.</p>
</div>
<h2 id="additional_attributes">Additional attributes</h2>
<div class="section-content"><p>In addition to the attributes that operate on all <a href="../input"><code><input></code></a> elements regardless of their type, <code>email</code> inputs support the following attributes.</p></div>
<h3 id="list">list</h3>
<div class="section-content"><p>The values of the list attribute is the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Element/id"><code>id</code></a> of a <a href="../datalist"><code><datalist></code></a> element located in the same document. The <a href="../datalist"><code><datalist></code></a> provides a list of predefined values to suggest to the user for this input. Any values in the list that are not compatible with the <a href="../input#type"><code>type</code></a> are not included in the suggested options. The values provided are suggestions, not requirements: users can select from this predefined list or provide a different value.</p></div>
<h3 id="maxlength">maxlength</h3>
<div class="section-content">
<p>The maximum string length (measured in UTF-16 code units) that the user can enter into the <code>email</code> input. This must be an integer value of 0 or higher. If no <code>maxlength</code> is specified, or an invalid value is specified, the <code>email</code> input has no maximum length. This value must also be greater than or equal to the value of <code>minlength</code>.</p> <p>The input will fail <a href="../../constraint_validation">constraint validation</a> if the length of the text value of the field is greater than <code>maxlength</code> UTF-16 code units long. Constraint validation is only applied when the value is changed by the user.</p>
</div>
<h3 id="minlength">minlength</h3>
<div class="section-content">
<p>The minimum string length (measured in UTF-16 code units) that the user can enter into the <code>email</code> input. This must be a non-negative integer value smaller than or equal to the value specified by <code>maxlength</code>. If no <code>minlength</code> is specified, or an invalid value is specified, the <code>email</code> input has no minimum length.</p> <p>The input will fail <a href="../../constraint_validation">constraint validation</a> if the length of the text entered into the field is fewer than <code>minlength</code> UTF-16 code units long. Constraint validation is only applied when the value is changed by the user.</p>
</div>
<h3 id="multiple">multiple</h3>
<div class="section-content">
<p>A Boolean attribute which, if present, indicates that the user can enter a list of multiple email addresses, separated by commas and, optionally, whitespace characters. See <a href="#allowing_multiple_email_addresses">Allowing multiple email addresses</a> for an example, or <a href="../../attributes/multiple">HTML attribute: multiple</a> for more details.</p> <div class="notecard note" id="sect1"> <p><strong>Note:</strong> Normally, if you specify the <a href="../input#required"><code>required</code></a> attribute, the user must enter a valid email address for the field to be considered valid. However, if you add the <code>multiple</code> attribute, a list of zero email addresses (an empty string, or one which is entirely whitespace) is a valid value. In other words, the user does not have to enter even one email address when <code>multiple</code> is specified, regardless of the value of <code>required</code>.</p> </div>
</div>
<h3 id="pattern">pattern</h3>
<div class="section-content">
<p>The <code>pattern</code> attribute, when specified, is a regular expression that the input's <a href="../input#value"><code>value</code></a> must match for the value to pass <a href="../../constraint_validation">constraint validation</a>. It must be a valid JavaScript regular expression, as used by the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp"><code>RegExp</code></a> type, and as documented in our <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions">guide on regular expressions</a>; the <code>'u'</code> flag is specified when compiling the regular expression so that the pattern is treated as a sequence of Unicode code points, instead of as <a href="https://developer.mozilla.org/en-US/docs/Glossary/ASCII">ASCII</a>. No forward slashes should be specified around the pattern text.</p> <p>If the specified pattern is not specified or is invalid, no regular expression is applied and this attribute is ignored completely.</p> <div class="notecard note" id="sect2"> <p><strong>Note:</strong> Use the <a href="../input#title"><code>title</code></a> attribute to specify text that most browsers will display as a tooltip to explain what the requirements are to match the pattern. You should also include other explanatory text nearby.</p> </div> <p>See the section <a href="#pattern_validation">Pattern validation</a> for details and an example.</p>
</div>
<h3 id="placeholder"><code>placeholder</code></h3>
<div class="section-content">
<p>The <code>placeholder</code> attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. It should be a word or short phrase that demonstrates the expected type of data, rather than an explanatory message. The text <em>must not</em> include carriage returns or line feeds.</p> <p>If the control's content has one directionality (<a href="https://developer.mozilla.org/en-US/docs/Glossary/LTR">LTR</a> or <a href="https://developer.mozilla.org/en-US/docs/Glossary/RTL">RTL</a>) but needs to present the placeholder in the opposite directionality, you can use Unicode bidirectional algorithm formatting characters to override directionality within the placeholder; see <a href="https://www.w3.org/International/questions/qa-bidi-unicode-controls" target="_blank">How to use Unicode controls for bidi text</a> for more information.</p> <div class="notecard note" id="sect3"> <p><strong>Note:</strong> Avoid using the <code>placeholder</code> attribute if you can. It is not as semantically useful as other ways to explain your form, and can cause unexpected technical issues with your content. See <a href="../input#labels"><code><input></code> labels</a> for more information.</p> </div>
</div>
<h3 id="readonly"><code>readonly</code></h3>
<div class="section-content">
<p>A Boolean attribute which, if present, means this field cannot be edited by the user. Its <code>value</code> can, however, still be changed by JavaScript code directly setting the <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement"><code>HTMLInputElement</code></a> <code>value</code> property.</p> <div class="notecard note" id="sect4"> <p><strong>Note:</strong> Because a read-only field cannot have a value, <code>required</code> does not have any effect on inputs with the <code>readonly</code> attribute also specified.</p> </div>
</div>
<h3 id="size"><code>size</code></h3>
<div class="section-content">
<p>The <code>size</code> attribute is a numeric value indicating how many characters wide the input field should be. The value must be a number greater than zero, and the default value is 20. Since character widths vary, this may or may not be exact and should not be relied upon to be so; the resulting input may be narrower or wider than the specified number of characters, depending on the characters and the font (<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/font"><code>font</code></a> settings in use).</p> <p>This does <em>not</em> set a limit on how many characters the user can enter into the field. It only specifies approximately how many can be seen at a time. To set an upper limit on the length of the input data, use the <a href="#maxlength"><code>maxlength</code></a> attribute.</p>
</div>
<h2 id="using_email_inputs">Using email inputs</h2>
<div class="section-content">
<p>Email addresses are among the most frequently-inputted textual data forms on the web; they're used when logging into websites, when requesting information, to allow order confirmation, for webmail, and so forth. As such, the <code>email</code> input type can make your job as a web developer much easier since it can help simplify your work when building the user interface and logic for email addresses. When you create an email input with the proper <code>type</code> value, <code>email</code>, you get automatic validation that the entered text is at least in the correct form to potentially be a legitimate email address. This can help avoid cases in which the user mistypes their address, or provides an invalid address.</p> <p>It's important, however, to note that this is not enough to ensure that the specified text is an email address which actually exists, corresponds to the user of the site, or is acceptable in any other way. It ensures that the value of the field is properly formatted to be an email address.</p> <div class="notecard note" id="sect5"> <p><strong>Note:</strong> It's also crucial to remember that a user can tinker with your HTML behind the scenes, so your site <em>must not</em> use this validation for any security purposes. You <em>must</em> verify the email address on the server side of any transaction in which the provided text may have any security implications of any kind.</p> </div>
</div>
<h3 id="a_simple_email_input">A simple email input</h3>
<div class="section-content">
<p>Currently, all browsers which implement this element implement it as a standard text input field with basic validation features. The specification does, however, allow browsers latitude on this. For example, the element could be integrated with the user's device's built-in address book to allow picking email addresses from that list. In its most basic form, an <code>email</code> input can be implemented like this:</p> <div class="code-example">
<p class="example-header"><span class="language-name">html</span></p>
<pre data-signature="Al9b1EOyvRpkJSHlloiBnPysLjDDsDzSaqwxanCynpg=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>emailAddress<span class="token punctuation">"</span></span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>email<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
</pre>
</div>
<div class="code-example" id="sect6">
<iframe class="sample-code-frame" title="A simple email input sample" id="frame_a_simple_email_input" width="600" height="60" src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/input/email/runner.html?id=a_simple_email_input" loading="lazy"></iframe>
</div> <p>Notice that it's considered valid when empty and when a single validly-formatted email address is entered, but is otherwise not considered valid. By adding the <a href="../input#required"><code>required</code></a> attribute, only validly-formed email addresses are allowed; the input is no longer considered valid when empty.</p>
</div>
<h3 id="allowing_multiple_email_addresses">Allowing multiple email addresses</h3>
<div class="section-content">
<p>By adding the <a href="../../attributes/multiple"><code>multiple</code></a> Boolean attribute, the input can be configured to accept multiple email addresses.</p> <div class="code-example">
<p class="example-header"><span class="language-name">html</span></p>
<pre data-signature="Hh5OQxz0INBP+DsAt5hy34Cg71iKOLp6z95sYhiOoxA=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>emailAddress<span class="token punctuation">"</span></span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>email<span class="token punctuation">"</span></span> <span class="token attr-name">multiple</span> <span class="token punctuation">/></span></span>
</pre>
</div>
<div class="code-example" id="sect7">
<iframe class="sample-code-frame" title="Allowing multiple email addresses sample" id="frame_allowing_multiple_email_addresses" width="600" height="60" src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/input/email/runner.html?id=allowing_multiple_email_addresses" loading="lazy"></iframe>
</div> <p>The input is now considered valid when a single email address is entered, or when any number of email addresses separated by commas and, optionally, some number of whitespace characters are present.</p> <div class="notecard note" id="sect8"> <p><strong>Note:</strong> When <code>multiple</code> is used, the value <em>is</em> allowed to be empty.</p> </div> <p>Some examples of valid strings when <code>multiple</code> is specified:</p> <ul> <li><code>""</code></li> <li><code>"me@example"</code></li> <li><code>"me@example.org"</code></li> <li><code>"me@example.org,you@example.org"</code></li> <li><code>"me@example.org, you@example.org"</code></li> <li><code>"me@example.org,you@example.org, us@example.org"</code></li> </ul> <p>Some examples of invalid strings:</p> <ul> <li><code>","</code></li> <li><code>"me"</code></li> <li><code>"me@example.org you@example.org"</code></li> </ul>
</div>
<h3 id="placeholders">Placeholders</h3>
<div class="section-content">
<p>Sometimes it's helpful to offer an in-context hint as to what form the input data should take. This can be especially important if the page design doesn't offer descriptive labels for each <a href="../input"><code><input></code></a>. This is where <strong>placeholders</strong> come in. A placeholder is a value that demonstrates the form the <code>value</code> should take by presenting an example of a valid value, which is displayed inside the edit box when the element's <code>value</code> is "". Once data is entered into the box, the placeholder disappears; if the box is emptied, the placeholder reappears.</p> <p>Here, we have an <code>email</code> input with the placeholder <code>sophie@example.com</code>. Note how the placeholder disappears and reappears as you manipulate the contents of the edit field.</p> <div class="code-example">
<p class="example-header"><span class="language-name">html</span></p>
<pre data-signature="fZppfPNBIvlrJzsM8mwpNi8ZdKymiGsjqlHfvqGgtSg=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>email<span class="token punctuation">"</span></span> <span class="token attr-name">placeholder</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>sophie@example.com<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
</pre>
</div>
<div class="code-example" id="sect9">
<iframe class="sample-code-frame" title="Placeholders sample" id="frame_placeholders" width="600" height="60" src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/input/email/runner.html?id=placeholders" loading="lazy"></iframe>
</div>
</div>
<h3 id="controlling_the_input_size">Controlling the input size</h3>
<div class="section-content">
<p>You can control not only the physical length of the input box, but also the minimum and maximum lengths allowed for the input text itself.</p> <h4 id="physical_input_element_size">Physical input element size</h4> <p>The physical size of the input box can be controlled using the <a href="../input#size"><code>size</code></a> attribute. With it, you can specify the number of characters the input box can display at a time. In this example the <code>email</code> edit box is 15 characters wide:</p> <div class="code-example">
<p class="example-header"><span class="language-name">html</span></p>
<pre data-signature="RjUBA7iApOL26b1ZYoehdt4lqvkJtj5rTMEqfnWkLsA=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>email<span class="token punctuation">"</span></span> <span class="token attr-name">size</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>15<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
</pre>
</div>
<div class="code-example" id="sect10">
<iframe class="sample-code-frame" title="Physical input element size sample" id="frame_physical_input_element_size" width="600" height="60" src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/input/email/runner.html?id=physical_input_element_size" loading="lazy"></iframe>
</div> <h4 id="element_value_length">Element value length</h4> <p>The <code>size</code> is separate from the length limitation on the entered email address itself so that you can have fields fit in a small space while still allowing longer email address strings to be entered. You can specify a minimum length, in characters, for the entered email address using the <a href="../input#minlength"><code>minlength</code></a> attribute; similarly, use <a href="../input#maxlength"><code>maxlength</code></a> to set the maximum length of the entered email address.</p> <p>The example below creates a 32 character-wide email address entry box, requiring that the contents be no shorter than 3 characters and no longer than 64 characters.</p> <div class="code-example">
<p class="example-header"><span class="language-name">html</span></p>
<pre data-signature="7nmyLiLQaqq+H/OF8w7lMAEuf7VGtyCiV6W0EQwmJtg=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>email<span class="token punctuation">"</span></span> <span class="token attr-name">size</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>32<span class="token punctuation">"</span></span> <span class="token attr-name">minlength</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>3<span class="token punctuation">"</span></span> <span class="token attr-name">maxlength</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>64<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
</pre>
</div>
<div class="code-example" id="sect11">
<iframe class="sample-code-frame" title="Element value length sample" id="frame_element_value_length" width="600" height="60" src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/input/email/runner.html?id=element_value_length" loading="lazy"></iframe>
</div>
</div>
<h3 id="providing_default_options">Providing default options</h3>
<div class="section-content">
<h4 id="providing_a_single_default_using_the_value_attribute">Providing a single default using the value attribute</h4> <p>As always, you can provide a default value for an <code>email</code> input box by setting its <a href="../input#value"><code>value</code></a> attribute:</p> <div class="code-example">
<p class="example-header"><span class="language-name">html</span></p>
<pre data-signature="KnGmkt9UMpzBxPwvMqqQMbGvkmridtYGhIsQlfuzsEc=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>email<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>default@example.com<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
</pre>
</div>
<div class="code-example" id="sect12">
<iframe class="sample-code-frame" title="Providing a single default using the value attribute sample" id="frame_providing_a_single_default_using_the_value_attribute" width="600" height="60" src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/input/email/runner.html?id=providing_a_single_default_using_the_value_attribute" loading="lazy"></iframe>
</div> <h4 id="offering_suggested_values">Offering suggested values</h4> <p>Taking it a step further, you can provide a list of default options from which the user can select by specifying the <a href="../input#list"><code>list</code></a> attribute. This doesn't limit the user to those options, but does allow them to select commonly-used email addresses more quickly. This also offers hints to <a href="../input#autocomplete"><code>autocomplete</code></a>. The <code>list</code> attribute specifies the ID of a <a href="../datalist"><code><datalist></code></a>, which in turn contains one <a href="../option"><code><option></code></a> element per suggested value; each <code>option</code>'s <code>value</code> is the corresponding suggested value for the email entry box.</p> <div class="code-example">
<p class="example-header"><span class="language-name">html</span></p>
<pre data-signature="BJ6VjNrRFCHLEiy6QHSdPpHIXr/84mKlng9CPfHm/g4=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>email<span class="token punctuation">"</span></span> <span class="token attr-name">size</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>40<span class="token punctuation">"</span></span> <span class="token attr-name">list</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>defaultEmails<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>datalist</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>defaultEmails<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>option</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>jbond007@mi6.defence.gov.uk<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>option</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>option</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>jbourne@unknown.net<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>option</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>option</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>nfury@shield.org<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>option</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>option</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>tony@starkindustries.com<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>option</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>option</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>hulk@grrrrrrrr.arg<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>option</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>datalist</span><span class="token punctuation">></span></span>
</pre>
</div>
<div class="code-example" id="sect13">
<iframe class="sample-code-frame" title="Offering suggested values sample" id="frame_offering_suggested_values" width="600" height="60" src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/input/email/runner.html?id=offering_suggested_values" loading="lazy"></iframe>
</div> <p>With the <a href="../datalist"><code><datalist></code></a> element and its <a href="../option"><code><option></code></a>s in place, the browser will offer the specified values as potential values for the email address; this is typically presented as a popup or drop-down menu containing the suggestions. While the specific user experience may vary from one browser to another, typically clicking in the edit box presents a drop-down of the suggested email addresses. Then, as the user types, the list is filtered to show only matching values. Each typed character narrows down the list until the user makes a selection or types a custom value.</p>
</div>
<h2 id="validation">Validation</h2>
<div class="section-content">
<p>There are two levels of content validation available for <code>email</code> inputs. First, there's the standard level of validation offered to all <a href="../input"><code><input></code></a>s, which automatically ensures that the contents meet the requirements to be a valid email address. But there's also the option to add additional filtering to ensure that your own specialized needs are met, if you have any.</p> <div class="notecard warning" id="sect14"> <p><strong>Warning:</strong> HTML form validation is <em>not</em> a substitute for scripts that ensure that the entered data is in the proper format.It's far too easy for someone to make adjustments to the HTML that allow them to bypass the validation, or to remove it completely. It's also possible for someone to bypass your HTML entirely and submit the data directly to your server. If your server-side code fails to validate the data it receives, disaster could strike when improperly-formatted data (or data which is too large, is of the wrong type, and so forth) is entered into your database.</p> </div>
</div>
<h3 id="basic_validation">Basic validation</h3>
<div class="section-content">
<p>Browsers automatically provide validation to ensure that only text that matches the standard format for Internet email addresses is entered into the input box. Browsers use an algorithm equivalent to the following regular expression:</p> <div class="code-example">
<p class="example-header"><span class="language-name">js</span></p>
<pre data-signature="GMNgi6tkfmZa7pnP23eey7eUgtkNgju5zaUhdV1rzK0=" data-language="js"><span class="token regex"><span class="token regex-delimiter">/</span><span class="token regex-source language-regex"><span class="token anchor function">^</span><span class="token char-class"><span class="token char-class-punctuation punctuation">[</span><span class="token range">a<span class="token range-punctuation operator">-</span>z</span><span class="token range">A<span class="token range-punctuation operator">-</span>Z</span><span class="token range">0<span class="token range-punctuation operator">-</span>9</span>.!#$%&'*+/=?^_`{|}~-<span class="token char-class-punctuation punctuation">]</span></span><span class="token quantifier number">+</span>@<span class="token char-class"><span class="token char-class-punctuation punctuation">[</span><span class="token range">a<span class="token range-punctuation operator">-</span>z</span><span class="token range">A<span class="token range-punctuation operator">-</span>Z</span><span class="token range">0<span class="token range-punctuation operator">-</span>9</span><span class="token char-class-punctuation punctuation">]</span></span><span class="token group punctuation">(?:</span><span class="token char-class"><span class="token char-class-punctuation punctuation">[</span><span class="token range">a<span class="token range-punctuation operator">-</span>z</span><span class="token range">A<span class="token range-punctuation operator">-</span>Z</span><span class="token range">0<span class="token range-punctuation operator">-</span>9</span>-<span class="token char-class-punctuation punctuation">]</span></span><span class="token quantifier number">{0,61}</span><span class="token char-class"><span class="token char-class-punctuation punctuation">[</span><span class="token range">a<span class="token range-punctuation operator">-</span>z</span><span class="token range">A<span class="token range-punctuation operator">-</span>Z</span><span class="token range">0<span class="token range-punctuation operator">-</span>9</span><span class="token char-class-punctuation punctuation">]</span></span><span class="token group punctuation">)</span><span class="token quantifier number">?</span><span class="token group punctuation">(?:</span><span class="token special-escape escape">\.</span><span class="token char-class"><span class="token char-class-punctuation punctuation">[</span><span class="token range">a<span class="token range-punctuation operator">-</span>z</span><span class="token range">A<span class="token range-punctuation operator">-</span>Z</span><span class="token range">0<span class="token range-punctuation operator">-</span>9</span><span class="token char-class-punctuation punctuation">]</span></span><span class="token group punctuation">(?:</span><span class="token char-class"><span class="token char-class-punctuation punctuation">[</span><span class="token range">a<span class="token range-punctuation operator">-</span>z</span><span class="token range">A<span class="token range-punctuation operator">-</span>Z</span><span class="token range">0<span class="token range-punctuation operator">-</span>9</span>-<span class="token char-class-punctuation punctuation">]</span></span><span class="token quantifier number">{0,61}</span><span class="token char-class"><span class="token char-class-punctuation punctuation">[</span><span class="token range">a<span class="token range-punctuation operator">-</span>z</span><span class="token range">A<span class="token range-punctuation operator">-</span>Z</span><span class="token range">0<span class="token range-punctuation operator">-</span>9</span><span class="token char-class-punctuation punctuation">]</span></span><span class="token group punctuation">)</span><span class="token quantifier number">?</span><span class="token group punctuation">)</span><span class="token quantifier number">*</span><span class="token anchor function">$</span></span><span class="token regex-delimiter">/</span></span><span class="token punctuation">;</span>
</pre>
</div> <p>To learn more about how form validation works and how to take advantage of the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:valid"><code>:valid</code></a> and <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:invalid"><code>:invalid</code></a> CSS properties to style the input based on whether the current value is valid, see <a href="https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation">Form data validation</a>.</p> <div class="notecard note" id="sect15"> <p><strong>Note:</strong> There are known specification issues related to international domain names and the validation of email addresses in HTML. See <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15489" target="_blank">W3C bug 15489</a> for details.</p> </div>
</div>
<h3 id="pattern_validation">Pattern validation</h3>
<div class="section-content">
<p>If you need the entered email address to be restricted further than just "any string that looks like an email address," you can use the <a href="../input#pattern"><code>pattern</code></a> attribute to specify a <a href="https://developer.mozilla.org/en-US/docs/Glossary/Regular_expression">regular expression</a> the value must match for it to be valid. If the <a href="../input#multiple"><code>multiple</code></a> attribute is specified, each individual item in the comma-delineated list of values must match the <a href="https://developer.mozilla.org/en-US/docs/Glossary/Regular_expression">regular expression</a>.</p> <p>For example, let's say you're building a page for employees of Best Startup Ever, Inc. which will let them contact their IT department for help. In our simplified form, the user needs to enter their email address and a message describing the problem they need help with. We want to ensure that not only does the user provide a valid email address, but for security purposes, we require that the address be an internal corporate email address.</p> <p>Since inputs of type <code>email</code> validate against both the standard email address validation <em>and</em> the specified <a href="../input#pattern"><code>pattern</code></a>, you can implement this easily. Let's see how:</p> <div class="code-example">
<p class="example-header"><span class="language-name">html</span></p>
<pre data-signature="mdOuiQfhct7xxxfmERsbf3T1y/bCqwaWISo8r6cjKco=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>form</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>emailBox<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>label</span> <span class="token attr-name">for</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>emailAddress<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Your email address<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>label</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>br</span> <span class="token punctuation">/></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span>
<span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>emailAddress<span class="token punctuation">"</span></span>
<span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>email<span class="token punctuation">"</span></span>
<span class="token attr-name">size</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>64<span class="token punctuation">"</span></span>
<span class="token attr-name">maxlength</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>64<span class="token punctuation">"</span></span>
<span class="token attr-name">required</span>
<span class="token attr-name">placeholder</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>username@beststartupever.com<span class="token punctuation">"</span></span>
<span class="token attr-name">pattern</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>.+@beststartupever\.com<span class="token punctuation">"</span></span>
<span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>Please provide only a Best Startup Ever corporate email address<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>messageBox<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>label</span> <span class="token attr-name">for</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>message<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Request<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>label</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>br</span> <span class="token punctuation">/></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>textarea</span>
<span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>message<span class="token punctuation">"</span></span>
<span class="token attr-name">cols</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>80<span class="token punctuation">"</span></span>
<span class="token attr-name">rows</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>8<span class="token punctuation">"</span></span>
<span class="token attr-name">required</span>
<span class="token attr-name">placeholder</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>My shoes are too tight, and I have forgotten how to dance.<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>textarea</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>submit<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>Send Request<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>form</span><span class="token punctuation">></span></span>
</pre>
</div>
<div class="code-example" id="sect16">
<iframe class="sample-code-frame" title="Pattern validation sample" id="frame_pattern_validation" width="700" height="300" src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/input/email/runner.html?id=pattern_validation" loading="lazy"></iframe>
</div> <p>Our <a href="../form"><code><form></code></a> contains one <a href="../input"><code><input></code></a> of type <code>email</code> for the user's email address, a <a href="../textarea"><code><textarea></code></a> to enter their message for IT into, and an <code><input></code> of type <a href="submit"><code>"submit"</code></a>, which creates a button to submit the form. Each text entry box has a <a href="../label"><code><label></code></a> associated with it to let the user know what's expected of them.</p> <p>Let's take a closer look at the email address entry box. Its <a href="../input#size"><code>size</code></a> and <a href="../input#maxlength"><code>maxlength</code></a> attributes are both set to 64 in order to show room for 64 characters worth of email address, and to limit the number of characters actually entered to a maximum of 64. The <a href="../input#required"><code>required</code></a> attribute is specified, making it mandatory that a valid email address be provided.</p> <p>An appropriate <a href="../input#placeholder"><code>placeholder</code></a> is provided—<code>username@beststartupever.com</code>—to demonstrate what constitutes a valid entry. This string demonstrates both that an email address should be entered, and suggests that it should be a corporate beststartupever.com account. This is in addition to the fact that using type <code>email</code> will validate the text to ensure that it's formatted like an email address. If the text in the input box isn't an email address, you'll get an error message that looks something like this:</p> <p> <img src="data:image/png;base64,iVBORw0KG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owDrC2HO8YiZqKBMCUGFpbu5CaVRktPHRCx1xc7PF0kE/RkNjhEFEBUhITNCPv7Ml9UEsioxaHr2wIdNPW+HH9Awi7oIJhAIiBf1MhO5bt6NV8u1gUfqiBwUCiTCQqIQJGihqcJl8+rlrrZhHq+Q/vHDo8BfUSCHCIKJyJigVNZdXA4tVzx5ONZQHg4i7goJSUX95Q71Y9Wz0Vq/wYABxR1AwKnQSq68iMRlA3DkUl6Q+Zqo2MZx5z1TEDB7+b+R/krgapMxnZOEAAAAASUVORK5CYII=" alt="Invalid email address in error state with a popout from the input reading 'please enter an email address'." width="530" height="125" loading="lazy"> </p> <p>If we left things at that, we would at least be validating on legitimate email addresses. But we want to go one step farther: we want to make sure that the email address is in fact in the form "<a href="mailto:_username_@beststartupever.com">_username_@beststartupever.com</a>". This is where we'll use <a href="../input#pattern"><code>pattern</code></a>. We set <code>pattern</code> to <code>.+@beststartupever.com</code>. This simple regular expression requests a string that consists of at least one character of any kind, then an "@" followed by the domain name "beststartupever.com".</p> <p>Note that this is not even close to an adequate filter for valid email addresses; it would allow things such as " @beststartupever.com" (note the leading space) or "@@beststartupever.com", neither of which is valid. However, the browser runs both the standard email address filter <em>and</em> our custom pattern against the specified text. As a result, we wind up with a validation which says "make sure this resembles a valid email address, and if it is, make sure it's also a beststartupever.com address."</p> <p>It's advisable to use the <a href="../../global_attributes#title"><code>title</code></a> attribute along with <code>pattern</code>. If you do, the <code>title</code> <em>must</em> describe the pattern. That is, it should explain what format the data should take on, rather than any other information. That's because the <code>title</code> may be displayed or spoken as part of a validation error message. For example, the browser might present the message "The entered text doesn't match the required pattern." followed by your specified <code>title</code>. If your <code>title</code> is something like "Email address", the result would be the message "The entered text doesn't match the required pattern. Email address", which isn't very good.</p> <p>That's why, instead, we specify the string "Please provide only a Best Startup Ever corporate email address" By doing that, the resulting full error message might be something like "The entered text doesn't match the required pattern. Please provide only a Best Startup Ever corporate email address."</p> <p> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUh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1T2oOV9EXci/mQV5ApKV5L9etAkuBFt0hX9Hl0CbtirP3IwkFw+IygIx9QMMXCoXcVpXdXN0E9vIBFvvARX84jBYY4DJMMgQHoOEqFos+4KOtso+rm8BeLsRCMLmAe5KeB4PFkkEMJkCGPSpomiO+D3BY9cTF1UX7rv39uEPThKgduIBA0vMOg4HByFApGZEoeA2AQ3NY9cTB1U1gLwG8RTRCuaCBpPfBMIMJkhG2OQENexTgmAQ8OkoLXF0E1gKb2QELpy1Mueh1h9EGA1zGIOYZQUBDUSIgu1VpO1c3ocEUBbAIYn4x2PsOg4JhkoF5BjgNYMPmdI6jlLbSCtetorZyOm1ARRhf0oD+ote5YGB0yAA0VBHhoLK1NWvjulXMWACFSF/W1hdcdMAAMhCNQfxzdnzzsXhNsyJXV6HJ8C/vBykWyEVfgEHJoE5jAFcgMd92YNEsfz52h9Bog4gFcxe9zkULjBYZlI2Bf7wGeWB2kOtODVAq+oML6W844AZjYaklXgAAAABJRU5ErkJggg==" alt="A valid email address, but the input is in error state with a popout from the input reading 'The entered text doesn't match the required pattern. Please provide only a Best Startup Ever corporate email address.'" width="536" height="140" loading="lazy"> </p> <div class="notecard note" id="sect17"> <p><strong>Note:</strong> If you run into trouble while writing your validation regular expressions and they're not working properly, check your browser's console; there may be helpful error messages there to aid you in solving the problem.</p> </div>
</div>
<h2 id="examples">Examples</h2>
<div class="section-content">
<p>Here we have an email input with the ID <code>emailAddress</code> which is allowed to be up to a maximum of 256 characters long. The input box itself is physically 64 characters wide, and displays the text <code>user@example.gov</code> as a placeholder anytime the field is empty. In addition, by using the <a href="../../attributes/multiple"><code>multiple</code></a> attribute, the box is configured to allow the user to enter zero or more email addresses, separated by commas, as described in <a href="#allowing_multiple_email_addresses">Allowing multiple email addresses</a>. As a final touch, the <a href="../input#list"><code>list</code></a> attribute contains the ID of a <a href="../datalist"><code><datalist></code></a> whose <a href="../option"><code><option></code></a>s specify a set of suggested values the user can choose from.</p> <p>As an added touch, the <a href="../label"><code><label></code></a> element is used to establish a label for the email entry box, with its <a href="../label#for"><code>for</code></a> attribute referencing the <code>emailAddress</code> ID of the <a href="../input"><code><input></code></a> element. By associating the two elements in this way, clicking on the label will focus the input element.</p> <div class="code-example">
<p class="example-header"><span class="language-name">html</span></p>
<pre data-signature="GEcPJmEt70+HN5kqWVMpUGX0NXfbcZP5lD/+mREKCH4=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>label</span> <span class="token attr-name">for</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>emailAddress<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Email<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>label</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>br</span> <span class="token punctuation">/></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span>
<span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>emailAddress<span class="token punctuation">"</span></span>
<span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>email<span class="token punctuation">"</span></span>
<span class="token attr-name">placeholder</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>user@example.gov<span class="token punctuation">"</span></span>
<span class="token attr-name">list</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>defaultEmails<span class="token punctuation">"</span></span>
<span class="token attr-name">size</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>64<span class="token punctuation">"</span></span>
<span class="token attr-name">maxlength</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>256<span class="token punctuation">"</span></span>
<span class="token attr-name">multiple</span> <span class="token punctuation">/></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>datalist</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>defaultEmails<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>option</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>jbond007@mi6.defence.gov.uk<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>option</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>option</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>jbourne@unknown.net<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>option</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>option</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>nfury@shield.org<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>option</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>option</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>tony@starkindustries.com<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>option</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>option</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>hulk@grrrrrrrr.arg<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>option</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>datalist</span><span class="token punctuation">></span></span>
</pre>
</div>
<div class="code-example" id="sect18">
<iframe class="sample-code-frame" title="Examples sample" id="frame_examples" width="600" height="80" src="https://live.mdnplay.dev/en-US/docs/Web/HTML/Element/input/email/runner.html?id=examples" loading="lazy"></iframe>
</div>
</div>
<h2 id="technical_summary">Technical summary</h2>
<div class="section-content"><figure class="table-container"><div class="_table"><table class="properties"> <tbody> <tr> <td><strong><a href="#value">Value</a></strong></td> <td> A string representing an email address, or empty </td> </tr> <tr> <td><strong>Events</strong></td> <td> <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event"><code>change</code></a> and <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event"><code>input</code></a> </td> </tr> <tr> <td><strong>Supported Common Attributes</strong></td> <td> <a href="../input#autocomplete"><code>autocomplete</code></a>, <a href="../input#list"><code>list</code></a>, <a href="../input#maxlength"><code>maxlength</code></a>, <a href="../input#minlength"><code>minlength</code></a>, <a href="../input#multiple"><code>multiple</code></a>, <a href="../input#name"><code>name</code></a>, <a href="../input#pattern"><code>pattern</code></a>, <a href="../input#placeholder"><code>placeholder</code></a>, <a href="../input#readonly"><code>readonly</code></a>, <a href="../input#required"><code>required</code></a>, <a href="../input#size"><code>size</code></a>, and <a href="../input#type"><code>type</code></a> </td> </tr> <tr> <td><strong>IDL attributes</strong></td> <td>
<code>list</code> and <code>value</code>
</td> </tr> <tr> <td><strong>DOM interface</strong></td> <td> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement"><code>HTMLInputElement</code></a></p> </td> </tr> <tr> <td><strong>Methods</strong></td> <td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/select"><code>select()</code></a></td> </tr> <tr> <td><strong>Implicit ARIA Role</strong></td> <td> with no <code>list</code> attribute: <code><a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/textbox_role">textbox</a></code><br>with <code>list</code> attribute: <code><a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/combobox_role">combobox</a></code> </td> </tr> </tbody> </table></div></figure></div>
<h2 id="specifications">Specifications</h2>
<div class="_table"><table class="standard-table">
<thead><tr><th scope="col">Specification</th></tr></thead>
<tbody><tr><td><a href="https://html.spec.whatwg.org/multipage/input.html#email-state-(type=email)">HTML Standard <br><small># email-state-(type=email)</small></a></td></tr></tbody>
</table></div>
<h2 id="browser_compatibility">Browser compatibility</h2>
<div class="_table"><table>
<thead>
<tr id="bct-browser-type">
<th></th>
<th colspan="6">Desktop</th>
<th colspan="6">Mobile</th>
</tr>
<tr id="bct-browsers">
<th></th>
<th>Chrome</th>
<th>Edge</th>
<th>Firefox</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari</th>
<th>WebView Android</th>
<th>Chrome Android</th>
<th>Firefox for Android</th>
<th>Opera Android</th>
<th>Safari on IOS</th>
<th>Samsung Internet</th>
</tr>
</thead>
<tbody><tr>
<th><code>email</code></th>
<td class="bc-supports-yes">5</td>
<td class="bc-supports-yes">12</td>
<td class="bc-supports-yes">1</td>
<td class="bc-supports-yes">10</td>
<td class="bc-supports-yes">11</td>
<td class="bc-supports-yes">5</td>
<td class="bc-supports-yes">4.4</td>
<td class="bc-supports-yes">18</td>
<td class="bc-supports-yes">4</td>
<td class="bc-supports-yes">11</td>
<td class="bc-supports-yes"><details><summary>3</summary>["Doesn't do validation, but instead offers a custom 'email' keyboard, which is designed to make entering email addresses easier.", "The custom 'email' keyboard does not provide a comma key, so users cannot enter multiple email addresses.", "Automatically applies a default style of <code>opacity: 0.4</code> to disable textual <code><input></code> elements, including those of type 'email'. Other major browsers don't currently share this particular default style."]</details></td>
<td class="bc-supports-yes">1.0</td>
</tr></tbody>
</table></div>
<h2 id="see_also">See also</h2>
<div class="section-content"><ul> <li><a href="https://developer.mozilla.org/en-US/docs/Learn/Forms">HTML forms guide</a></li> <li><a href="../input"><code><input></code></a></li> <li><a href="tel"><code><input type="tel"></code></a></li> <li><a href="url"><code><input type="url"></code></a></li> <li>Attributes: <ul> <li><a href="../input#list"><code>list</code></a></li> <li><a href="../../attributes/minlength"><code>minlength</code></a></li> <li><a href="../../attributes/maxlength"><code>maxlength</code></a></li> <li><a href="../../attributes/multiple"><code>multiple</code></a></li> <li><a href="../../attributes/pattern"><code>pattern</code></a></li> <li><a href="../input#placeholder"><code>placeholder</code></a></li> <li><a href="../../attributes/readonly"><code>readonly</code></a></li> <li><a href="../../attributes/size"><code>size</code></a></li> </ul> </li> <li><a href="https://developer.mozilla.org/en-US/docs/Learn/Forms/Property_compatibility_table_for_form_controls">Compatibility of CSS properties</a></li> </ul></div><div class="_attribution">
<p class="_attribution-p">
© 2005–2023 MDN contributors.<br>Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.<br>
<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email" class="_attribution-link">https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email</a>
</p>
</div>
|