Don't talk nonsense, just go to the Code directly (because you only find the solution when you encounter it, and put it here to make it easier for you to see and use it later)
The preceding methods can control the length of textarea, but only [onpropertychange] is the best method:
Onpropertychange: not explained. I personally think it is best to be similar to the maxlength attribute.
Onchange: This attribute can also be implemented, but the effect is that after the input, the value inside the mouse leaves textarea will become the limit length.
Onkeydown and onkeypress:
I have never quite understood the difference between onkeydown and onkeypress. when the length of the two methods above reaches the limit, if the input value is different from the last character value in the textarea content, and then change the value of the last character to the current input value.
Onkeyup.
Finally, the last three methods cannot solve the pasting problem. I wanted to put a tool that can be run directly on this page, but it is not very good yet. You will take a look.
Finally, ask me how to use Jsfiddle or other tools in my blog.