DOM Properties
ValidityState.tooShort
Reports a nonempty user-edited value shorter than minlength, measured in UTF-16 code units. Script assignment alone does not trigger the length constraint; the example illustrates this limitation. Example result: false.
Formal Syntax & Structure
html syntaxhtml
input.validity.tooShortReturn Value
boolean
Read-only constraint flag.
Working Example
Example Snippethtml
<input minlength="4" aria-label="Code"><p> Result: <output id="result"></output></p><script> const result = document.getElementById("result"); (async () => { const input = document.querySelector("input"); input.value = "ab"; result.textContent = input.validity.tooShort; })().catch(error => { result.textContent = "Error: " + error.name; });</script>