YouTip LogoYouTip

Prop Url Size

HTML DOM Input URL size Property

HTML DOM Input URL size Property

HTML DOM Input URL size Property

-- Learning is not just about technology, but also about dreams!

JavaScript Reference Manual

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

<input> - time

<input> - week

Deep Dive

  • Development Tools
  • Scripting Languages
  • Software
  • Web Design and Development
  • Computer Science
  • Programming Languages
  • Web Service
  • Network Services
  • Programming
  • Scripting

Input URL size Property

Input URL Object Reference Manual Input URL Object

Example

Change the length of the 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 property describes the length (number of characters) of the URL field.

The default value is 20.

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


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The size property is supported by all major browsers.

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


Syntax

Return the size property:

urlObject.size

Set the size property:

urlObject.size=number

Property Values

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

Technical Details

Return Value: A number, representing the length (number of characters) of the URL field.

More Examples

Example

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

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

The x output will be:

30

Try it Yourself Β»


Related Pages

HTML Reference: HTML <input> size Attribute


Input URL Object Reference Manual Input URL Object

<input> - time

<input> - week

ByteDance Coding Plan supports mainstream large models such as Doubao, GLM, DeepSeek, Kimi, MiniMax, etc., officially supplied, stable and reliable. Configuration Guide Β₯9.9/month Subscribe Now

← Prop Url SizeProp Url Required β†’