To set a maximum number of characters on an
textarea tag in HTML, you can use the
maxlength attribute on either of those tags and pass the maximum numbers of characters it should take as an integer value to it.
For example, let's say we have an
input tag of type text and we want to limit the characters to
30. We can achieve this functionality like this,
<input type="text" maxlength="30" />
You can also pass the
maxlength attribute to a
textarea tag to limit characters like this,
See the above examples live in JSBin.