Input URL size property
Example
Modify the length of the URL field:
document.getElementById("myURL").size = "50";
Try it »
Definition and Usage
The size property is used to set or return the value of the URL field's size attribute.
The size property describes the length of the URL field (number of characters).
The default value is 20.
Tip: If you need to set the maximum number of characters allowed in the url field, please use maxLength attribute.
Browser support





All major browsers support the size property.
Note: Internet Explorer or Safari browsers do not support HTML that uses the type="url" attribute. .
Syntax
Return the size property:
urlObject
.size
Set the size property:
urlObject
.size=
number
Attribute values
| Value | Description |
|---|---|
| number | Describes the length of the URL field, in number of characters. The default value is 20. |
Technical Details
| Return Value: | A number representing the length of the URL field, in number of characters. |
|---|
More examples
Example
Display the length of the URL field (number of characters):
var x = document.getElementById("myURL").size;
x
The output is:
30
Try it »
Related pages
HTML Reference Manual: HTML size property
The Input URL object