THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Input URL size Property

Input URL Object Reference Input URL Object

Example

Change the width of a URL field:

document.getElementById("myURL").size = "50";
Try it Yourself »

Definition and Usage

The size property sets or returns the value of the size attribute of a URL field.

The size attribute specifies the width of an URL 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

Internet Explorer Firefox Opera Google Chrome Safari

The size property is supported in all major browsers.

Note: The <input type="url"> element is not supported in Internet Explorer 9 and earlier versions, or in Safari.


Syntax

Return the size property:

urlObject.size

Set the size property:

urlObject.size=number

Property Values

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

Technical Details

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

More Examples

Example

Display the width of a URL field (in number of characters):

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

The result of x will be:

30
Try it Yourself »

Related Pages

HTML reference: HTML <input> size Attribute


Input URL Object Reference Input URL Object