The contenteditableglobal attribute is an enumerated value that tells the browser whether an element’s content can be edited by the user. Use true (or an empty string) for rich editing, plaintext-only for text without formatting, or false to lock editing.
Editable elements can receive focus and join sequential keyboard navigation. Style the caret with CSS caret-color. For plain form fields, prefer <textarea> when you need normal form submission.
Baseline · Widely available.
Not deprecated and not experimental. Support for plaintext-only is newer in some browsers — check if you rely on it.
Not a boolean attribute.
Even though values include true / false, it is enumerated. Prefer an explicit value. Bare contenteditable equals an empty string (editable).
Change the value, then click the box and type. Try pasting formatted text when using plaintext-only.
Click the region below and edit. Paste rich text to compare true vs plaintext-only.
editable region
Edit this text. Paste formatted content to test paste behavior.
contenteditable="true"
Code
HTML Examples
Short, copy-ready snippets. Use Try It Yourself for a live editor.
Example 1 — Basic contenteditable="true"
Make a blockquote and cite editable — click and type.
HTML
<blockquote contenteditable="true">
<p>Edit this content to add your own quote.</p>
</blockquote>
<cite contenteditable="true">-- Write your name here</cite>
contenteditable="true" turns the element into an editable region.
Focus the element (click or Tab) and type like a text field.
Works on many tags — headings, paragraphs, list items, and more.
Not form data by default — read innerHTML / textContent with script if you need to save it.
Example 2 — true vs plaintext-only
Compare paste behavior: rich formatting kept vs stripped.
HTML
<p><strong>Copy this:</strong> <em>Italic</em> and bold text.</p>
<p>Rich editable:</p>
<div contenteditable="true">Paste here (formatting may remain).</div>
<p>Plain text only:</p>
<div contenteditable="plaintext-only">Paste here (formatting removed).</div>
true often keeps bold, lists, and other markup when pasting.
plaintext-only keeps typing as text and strips rich paste formatting.
Pick based on need — notes apps may want rich text; comments often want plain.
Browser support for plaintext-only is newer — test your target browsers.
Example 3 — Nested editable + tabindex
Nested contenteditable regions are skipped in tab order unless you add tabindex.
HTML
<div contenteditable="true">
Outer editable area.
<p contenteditable="true" tabindex="0">
Nested editable — Tab can focus this because of tabindex="0".
</p>
</div>
Inherit: missing/invalid values follow the parent.
Nested Tab: use tabindex="0" when needed.
One line:contenteditable turns elements into in-page editors — choose true or plaintext-only with care.
Frequently Asked Questions
It is a global enumerated attribute that makes an element’s content editable in the browser. Users can type into the element when it is set to true (or an empty string) or plaintext-only.
No. It is enumerated. Allowed values include true, false, plaintext-only, and an empty string (same as true). Missing or invalid values inherit from the parent.
The element’s raw text is editable, but rich formatting is disabled. Pasted content typically loses bold, links, and other markup.
textarea is a form control for plain text that submits with forms. contenteditable can edit almost any element and may allow rich formatting unless you use plaintext-only.
Nested contenteditable elements are not in the tab sequence by default. Add tabindex="0" when a nested region should be keyboard-focusable.
No. Meta content holds metadata values. contenteditable makes page content editable.