input maxlength Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Description

The maxlength attribute specifies the maximum number of characters allowed in the <input> element.

Attribute Values

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

An <input> element with a maximum length of 10 characters:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php">
  Username: <input type="text" name="usrname" maxlength="10"><br>
  <input type="submit" value="Submit">
</form><!--   ww  w  .ja  v a2s.c o  m-->

</body>
</html>

Related Tutorials