How to Limit Characters in an HTML Textarea?

Find out how you can set maximum character limit in an HTML textarea

To limit the number of characters (as UTF-16 code units to be specific) that can be added to an HTML <textarea> element, you simply need to add the maxlength attribute on it (which is very well-supported across different browsers).

For example, to limit a <textarea> element to a maximum of 10 characters you would do the following:

<textarea maxlength="10"></textarea>

Hope you found this post useful. It was published . Please show your love and support by sharing this post.