contenteditable

The contenteditable global attribute makes an element's content directly editable by the user.

Since HTML5 Spec ↗

Syntax

contenteditable="true"

Examples

<div contenteditable="true">Click and type to edit me.</div>
<p contenteditable="plaintext-only">Plain text editing only.</p>
Output
Renders an editable rich-text box and a second box that accepts only plain text input.

Notes

Values: true, false, plaintext-only. Listen for the input event to capture changes. Build accessible rich editors carefully; raw contenteditable lacks undo consistency and accessible semantics.

Browser & runtime support

EnvironmentSince version
chrome 4.0
firefox 3.5
safari 3.1
edge 12