HTML Global Attributes Contenteditable Attribute


Example

<p contenteditable>This is an editable paragraph.</p>

Upon clicking on the paragraph, the content of it can be edited similar to an input text field.

When the contenteditable attribute is not set on an element, the element will inherit it from its parent. So all child text of a content editable element will also be editable, but you can turn it off for specific text, like so:

<p contenteditable>
  This is an editable paragraph.
  <span contenteditable="false">But not this.</span>
</p>

Note that an uneditable text element inside an editable element will still have a text cursor as inherited from its parent as well.