HTML DOM Input URL maxLength property
Examples
Get URL field allows you to enter the maximum number of characters:
var x = document.getElementById("myURL").maxLength;
x The output is: 30
try it"
Definition and Usage
maxLength attribute is used to set or return maxlength attribute URL field.
maxLength attribute describes the maximum URL field, enter the number of characters allowed.
The default value is 524288.
Tip: If you need to set the length of the URL, the number of characters, please use the size property.
Browser Support
All major browsers support maxLength property
Note: Internet Explorer or Safari browser does not support the use of type = "url" attribute of the HTML <input> elements.
grammar
Back maxLength attributes:
urlObject .maxLength
Setting maxLength properties:
urlObject .maxLength= number
Property Value
值 | 描述 |
---|---|
number | 描述了 URL 字段允许输入的最大字符数。 默认值为 524288 |
technical details
return value: | Number that represents the maximum URL field, enter the number of characters allowed. |
---|
More examples
Examples
Setting URL field allows you to enter the maximum number of characters:
document.getElementById("myURL").maxLength = "8";
try it"
Related Pages
HTML Reference Manual: HTML <the INPUT> MAXLENGTH property
Input URL objects