HTML <input> maxlength Atribut

❮ HTML tag <input>

Příklad

Prvek <input> s maximální délkou 10 znaků:

<form action="/action_page.php">
  <label for="username">Username:</label>
  <input type="text" id="username" name="username" maxlength="10"><br><br>
  <input type="submit" value="Submit">
</form>

Definice a použití

Atribut maxlengthurčuje maximální počet znaků povolených v <input>prvku.


Podpora prohlížeče

Čísla v tabulce určují první verzi prohlížeče, která tento atribut plně podporuje.

Attribute
maxlength Yes Yes Yes Yes Yes

Syntax

<input maxlength="number">

Hodnoty atributů

Value Description
number The maximum number of characters allowed in the <input> element. Default value is 524288

❮ HTML tag <input>