Easy Tutorial
❮ Prop Style Animationduration Prop Video Duration ❯

Input URL size Attribute

Input URL Object

Example

Modify the length of the URL field:

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

Definition and Usage

The size attribute is used to set or return the value of the size attribute of a URL field.

The size attribute describes the length of the URL field in characters.

The default value is 20.

Tip: If you need to set the maximum number of characters allowed in the URL field, use the maxLength attribute.


Browser Support

All major browsers support the size attribute.

Note: Internet Explorer or Safari browsers do not support the HTML <input> element with the type="url" attribute.


Syntax

Return the size attribute:

Set the size attribute:

Attribute Values

Value Description
number Describes the length of the URL field in characters. The default value is 20.

Technical Details

| Return Value: | A number, representing the length of the URL field in characters. | | --- | --- |


More Examples

Example

Display the length of the URL field (in characters):

var x = document.getElementById("myURL").size;
30

Related Pages

HTML Reference: HTML <input> size Attribute


❮ Prop Style Animationduration Prop Video Duration ❯