The maxlength attribute on an <input> tag specifies the maximum number of characters that can be entered in the input field.
Default is 524,288 characters.
A maxlength attribute on an <input> element.
The maxlength specified the number of characters allowed in this text input.
<form action="/tutorial/action.html">
<label for="title">Title </label>
<input type="text" id="title" name="title"
maxlength="15"><br /><br />
<input type="submit">
</form>
The maxlength attribute specifies the maximum number of characters that can be entered in the input field.
By default, the maximum is 524,288 characters.
<input maxlength="number">
Value | Description |
---|---|
number | The maximum number of characters. |
Here is when maxlength support started for each browser:
Chrome
|
1.0 | Sep 2008 |
Firefox
|
1.0 | Sep 2002 |
IE/Edge
|
1.0 | Aug 1995 |
Opera
|
1.0 | Jan 2006 |
Safari
|
1.0 | Jan 2003 |
Back to <input>