What is a cross-browser way to set the maximum number of characters in a textarea, using plain Javascript? maxlength
does not work for textareas on Opera and IE9 and below (though it works on all major browsers for inputs).
Once the character limit is reached, the textarea should not allow more characters to be entered. Text pasted either with Ctrl+V or the right-click context menu should be cut off at the character limit. This means a solution that uses only onkey___
events is not sufficient.