An HTML text input has an attribute called \"maxlength\", implemented by browsers, which if set blocks user input after a certain number of characters.
An HTML texta
I think the following is as "clean" as it gets. Make an event handler in Javascript that takes the keydown event and the textarea field as input. Check the length of the text in the field in this handler and return false if the maxlength is reached. (Of course make any css style switching before returning). Return true otherwise. The textarea should look like this.