From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/html/attributes%2Fmaxlength.html | 114 +++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 devdocs/html/attributes%2Fmaxlength.html (limited to 'devdocs/html/attributes%2Fmaxlength.html') diff --git a/devdocs/html/attributes%2Fmaxlength.html b/devdocs/html/attributes%2Fmaxlength.html new file mode 100644 index 00000000..f8fc3fbf --- /dev/null +++ b/devdocs/html/attributes%2Fmaxlength.html @@ -0,0 +1,114 @@ +

HTML attribute: maxlength

+

The maxlength attribute defines the maximum string length that the user can enter into an <input> or <textarea>. The attribute must have an integer value of 0 or higher.

The length is measured in UTF-16 code units, which (for most scripts) is equivalent to the number of characters. If no maxlength is specified, or an invalid value is specified, the input has no maximum length.

Any maxlength value must be greater than or equal to the value of minlength, if present and valid. The input will fail constraint validation if the length of the text value of the field is greater than maxlength UTF-16 code units long. Constraint validation is only applied when the value is changed by the user.

+
+

Constraint validation

+

While the browser will generally prevent user from entering more text than the maxlength attribute allows, should the length be longer than the maxlength allows, the read-only tooLong property of a ValidityState object will be true.

+

Try it

+
+

Examples

+
+
+

html

+
<input type="password" maxlength="4" />
+
+
+
+ + +
+
+

Specifications

+
+ + +
Specification
HTML Standard
# the-maxlength-and-minlength-attributes
+

Browser compatibility

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariWebView AndroidChrome AndroidFirefox for AndroidOpera AndroidSafari on IOSSamsung Internet
maxlength412410≤12.15≤37184≤12.151.0
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariWebView AndroidChrome AndroidFirefox for AndroidOpera AndroidSafari on IOSSamsung Internet
maxlength11215.5≤12.114.4184≤12.111.0
+

html.elements.input.maxlength

+

BCD tables only load in the browser

+

html.elements.textarea.maxlength

+

BCD tables only load in the browser

+

See also

+
+

+ © 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
+ https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/maxlength +

+
-- cgit v1.2.3