Input Email size
Attribute
Example
Modify the width of the email field:
document.getElementById("myEmail").size = "50";
Definition and Usage
The size
attribute is used to set or return the value of the size attribute of the email field.
The size
attribute describes the length of the email field in characters.
The default value is 20.
Tip: To set or return the maximum number of characters for the email field, you can use the maxLength attribute.
Browser Support
All major browsers support the size
attribute.
Note: Internet Explorer 9 (and earlier versions), or Safari do not support the HTML <input>
element with type="email"
.
Syntax
Return the size
attribute:
Set the size
attribute:
Attribute Values
Value | Description |
---|---|
number | Describes the length of the email field in characters. The default value is 20. |
Technical Details
| Return Value: | A number, representing the length of the email field in characters. | | --- | --- |
More Examples
Example
Display the length of the email field (in characters):
var x = document.getElementById("myEmail").size;
30
Related Pages
HTML reference: HTML <input> size Attribute