Filter (Advanced Search)
Downloads
0
Views
231
Video

Video is not available... Embedded is previous playlist.

Details

The input maxlength attribute specifies the maximum number of characters allowed in an input field.

Note: When a maxlength is set, the input field will not accept more than the specified number of characters. However, this attribute does not provide any feedback. So, if you want to alert the user, you must write JavaScript code.


<!DOCTYPE html>
<html>
<body>

<h1>The input maxlength attribute</h1>

<p>The maxlength attribute specifies the maximum number of characters allowed in an input field:</p>

<form action="/php/actionPagePost.php" method="post">
  <label for="fname">First name:</label><br>
  <input type="text" id="fname" name="fname" size="40"><br>
  <label for="lname">Last name:</label><br>
  <input type="text" id="lname" name="lname" maxlength="4" size="10"><br><br>
  <input type="submit" value="Submit">
</form>

</body>
</html>



Ad