jQuery - set max length for textarea <p>I want to have a textarea with a maximum length, and show the user how many characters are left (as it's done on twitter), but I can't seem to get it to be as good.</p> <p>The requirements are:</p> <ul> <li>Must show the current number of characters they've typed</li> <li>Must remain accurate when a key is held down</li> <li>Must remain accurate when backspace/delete is used</li> <li>Must remain accurate when text in the box is selected and cut/delete by using the right click menu</li> <li>Must allow the user to go over the limit (I hate it when a field actually prevents me from going over, it makes it harder to edit it down)</li> </ul> <p>Is there a jQuery plugin to do this? Or is there a simple javascript way of doing it (the onChange method doesn't update as they're typing, and keydown/keyup would have troubles with mouse changes)</p> <p>At the moment it seems like the best way is to have a function to do what I want (check the length and update the message), call it with keydown/keyup/change, and also poll it a few times per second. Is there a better way?</p>