Input Email size Attribute

Definition and Usage

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

The HTML size attribute specifies the width of the email field (in number of characters), with a default value of 20.

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

See also:

HTML Reference Manual:HTML <input> size Attribute

Example

Example 1

Set the email field as a required part of the form submission:

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

Try it yourself

Example 2

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

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

Try it yourself

Syntax

Return the size attribute:

emailObject.size

Set the size attribute:

emailObject.size = number

Attribute Value

Value Description
number Specifies the width of the email field in terms of the number of characters. The default value is 20.

Technical Details

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

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support