Input Email sizeProperty

Input Email 对象参考手册Input Email Object

Example

Modify the width of the email field:

document.getElementById("myEmail").size = "50";

Try it Yourself »

Definition and Usage

The size property 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 (number of characters).

The default value is 20.

Tip:To set or return the maximum number of the email field, you can use the maxLengthproperty.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the size attribute

Note:Internet Explorer 9 (and earlier IE versions), or Safari browser do not support the HTML <input> element with type="email".


Syntax

Return the size property:

emailObject.size

Set the size property:

emailObject.size=number

Property Value

Value Description
number Describes the length of the email field, i.e., the number of characters. The default value is 20

Technical Details

Return Value: A number, representing the length of the email field, i.e., the number of characters.


More Examples

Example

Display the length of the email field (number of characters):

var x = document.getElementById("myEmail").size;
xThe output result is:
30

Try it Yourself »


Related Pages

HTML reference: HTML <input> size Attribute


Input Email 对象参考手册Input Email Object Other Extensions