Why specifically mention textarea? Because the textarea node is actually very special. Because this node is special, the explanation of it is different in IE and other browsers.
Stop selling it, haha! In fact, the main reason is that I helped a senior brother repair a bug today. Specifically, it failed to pull data from the server and insert it into textarea. This situation only occurs in IE. All other browsers are normal!
First of all, why is textarea special? In all form plugins, the value of textarea is written between two open and closed tags, so its value can be regarded as a text node from the perspective of the DOM, which is unique to textarea. Because of this feature, when you modify its innerHTML value, you can still change the text of the textarea. Although IE supports doing this, it does not allow one thing: dynamically insert some html tags.
You might as well do an experiment:
Insert a piece of HTML code through JS in IE, using the innerHTML attribute instead of value or innerText.
I did not test IE9+, but IE6, 7, and 8 will report errors.
It is probably for security reasons, so JS is not allowed to dynamically insert html into textarea, but careful people can find that if you type the html code manually, textarea is acceptable. I think this actually went through a process like this: character escape. Yes, this is the only reason why manual html code is successful.
So, in my opinion, since so many browser textareas do not support html display, why do you still need to use the innerHTML attribute when operating JS? In other words, no matter whether you insert html code with value or innerHTML with html code, it will not be parsed and displayed (so there will be a rich text editor instead of textarea). So why not use value to set the value of textarea?
So I think that setting the value of textarea should not be through innerHTML (of course it is even more impossible to be innerText because of firefox), but should be set through value. This is something developers should pay attention to. Because I have recently read some children's shoes codes that always like to use innerHTML. Actually, I think this is all about occasions.