HTML contenteditable attribute

HTML Contenteditable attribute allows the user to edit the content. Every element can use this attribute.

<div contenteditable>
  The content inside every html element is editable because of 'contenteditable' attribute.
  By default, div element is not editable . But it becomes editable by the contenteditable attribute.
</div>
</>
The content inside every html element is editable because of 'contenteditable' attribute. By default, div element is not editable . But it becomes editable by the contenteditable attribute.

Related Tags

The tags that support contenteditable attribute

<div> tag

div element is a block of content usually used to style the content.

<div contenteditable>
  This is a block of content and it is editable. It is the last priority of authors to write the content. It is used to style the content. 
 </div>
Try</>

<p> tag

div element is a block of content usually used to style the content.

<p contenteditable>
This is a paragraph that is editable. We can add more text.
</p>
Try</>

<section> tag

contenteditable attribute applies to all the child elements. In the following example, contenteditable is applied on the section element and all the child elements of section element become editable.

<div contenteditable>
  This is a block of content and it is editable. It is the last priority of authors to write the content. It is used to style the content. 
 </div>
Try</>


Was this article helpful?