Input URL maxLength Attribute
Definition and Usage
maxLength
Set or return the value of the maxLength attribute of the URL field.
The HTML maxLength attribute specifies the maximum number of characters allowed in the URL field, with a default value of 524288.
Tip:To set or return the width of the URL field (in characters), use size Properties.
See also:
HTML Reference Manual:HTML <input> maxlength Attribute
Example
Example 1
Get the maximum number of characters allowed in a specific URL field:
var x = document.getElementById("myURL").maxLength;
Example 2
Set the maximum number of characters allowed in the URL field:
document.getElementById("myURL").maxLength = "8";
Syntax
Return the maxLength attribute:
urlObject.maxLength
Set the maxLength attribute:
urlObject.maxLength = number
Attribute Value
Value | Description |
---|---|
number | Specifies the maximum number of characters allowed in the URL field. The default value is 524288. |
Technical Details
Return Value: | Number, representing the maximum number of characters allowed in the URL field. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Supported | 10.0 | Supported | Not Supported | Supported |