HTML <input> minlength-eigenschap

Definitie en gebruik

minlength Het kenmerk bepaalt het minimale aantal tekens dat het <input>-element vereist.

Let op:minlength The attribute can be used for the following input types:

  • text
  • search
  • url
  • tel
  • email
  • password

Example

An <input> element with a minimum length of 8 characters:

<form action="/action_page.php">
  <label for="password">Password:</label>
  <input type="password" id="password" name="password" minlength="8"><br><br>
  <input type="submit" value="Submit">
</form>

Try it yourself

Syntax

<input minlength="number">

Attribute value

Value Description
number The minimum number of characters required in the <input> element.

Browser support

The numbers in the table indicate the first browser version to fully support this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
40.0 17.0 51.0 10.1 27.0