HTML DOM Input Email size Property

Input Email Object : Change the width of an email field

Definition and Usage

The size property sets or returns the value of the size attribute of an email field.

The size attribute specifies the width of an email field (in number of characters).

The default value is 20.

Tip: To set or return the maximum number of characters allowed in the password field, use the maxLength property.

Browser Support

Property
size Yes 10.0 Yes Yes Yes

Syntax

Return the size property:

emailObject.size

Set the size property:

emailObject.size = number

Property Values

Value Description
number Specifies the width of the email field, in number of characters. Default value is 20

Technical Details

Return Value: A Number, representing the width of the email field, in number of characters

More Examples

Example

Display the width of an email field (in number of characters):

var x = document.getElementById("myEmail").size;

Related Pages

HTML reference: HTML <input> size attribute

❮ Input Email Object