YouTip LogoYouTip

Prop Url Maxlength

# Input URL maxLength Property [![Image 8: Input URL Object Reference Manual](#) Input URL Object](#) ## Example Get the maximum number of characters allowed in the URL field: ```javascript var x = document.getElementById("myURL").maxLength; The output of _x_ is: 30 [Try it Β»](#) * * * ## Definition and Usage The maxLength property is used to set or return the maxlength attribute of a URL field. The maxLength property describes the maximum number of characters allowed in the URL field. The default value is 524288. **Tip:** To set the length (i.e., the number of characters) of the URL, use the (#) property. * * * ## Browser Support ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) The maxLength property is supported by all major browsers. **Note:** Internet Explorer and Safari do not support the HTML element with type="url". * * * ## Syntax Return the maxLength property: ```javascript _urlObject_.maxLength Set the maxLength property: ```javascript _urlObject_.maxLength=_number_ ## Property Values | Value | Description | | --- | --- | | _number_ | Describes the maximum number of characters allowed in the URL field. The default value is 524288 | ## Technical Details | Return Value: | A number, representing the maximum number of characters allowed in the URL field. | | --- | * * * ## More Examples ## Example Set the maximum number of characters allowed in the URL field: ```javascript document.getElementById("myURL").maxLength = "8"; [Try it Β»](#) * * * ## Related Pages HTML Reference: (#) * * Input URL Object](#)
← Prop Url NameProp Url Maxlength β†’