Home >Web Front-end >HTML Tutorial >Set the contenteditable attribute to edit the content of HTML tags (can replace textarea)_HTML/Xhtml_Web page production
The contenteditable attribute is compatible with all browsers (the compatibility of versions prior to IE6 has not been tested)
In some cases, we can use DIV to replace input or textarea to achieve the same effect. For example, when using ajax, we can get the content of the DIV when submitting the form.
Careful people will find that the text box for posting comments in QQ space is actually a DIV, not a textarea text box.
How Div CSS simulates textarea text area height adaptability to meet the HTML5 standard contenteditable attribute
This effect is mainly achieved by adding the contenteditable attribute in HTML5 to the tag (contenteditable: specifies whether users are allowed to edit content). What’s great is that IE also supports this attribute, so you don’t have to worry too much about compatibility issues.
DEMO: