coderef

contenteditable="plaintext-only"Baseline · Newly available

The contenteditable="plaintext-only" global HTML attribute allows the user to edit the content of an element, but prevents rich-text formatting.

Works in the latest version of every major browser, but older devices may not support it yet. Baseline since Mar 4, 2025.

Browser support

DesktopChrome
1–50Not supported
51+Supportedsince May 25, 2016
Current: 155
Edge
12+Supportedsince Jul 29, 2015
Current: 154
Firefox
1–135Not supported
136+Supportedsince Mar 4, 2025
Current: 157
Safari
1–5Not supported
5.1+Supportedsince Jul 20, 2011
Current: 27
MobileChrome Android
18–50Not supported
51+Supportedsince Jun 8, 2016
Current: 155
Firefox Android
4–135Not supported
136+Supportedsince Mar 4, 2025
Current: 157
Safari iOS
1–4.2Not supported
5+Supportedsince Oct 12, 2011
Current: 27

How to use

Every current browser supports this, but it only became Baseline on Mar 4, 2025. Use it as a progressive enhancement, or keep a fallback if you support older devices.

Example

Full syntax and examples are on MDN — see the links below.

Feature detection

JS · check before using
if ("HTMLElement" in globalThis && "contentEditable" in HTMLElement.prototype) {
  // HTMLElement.contentEditable is available
}

Sub-features

Support for each part of the feature (2). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
HTMLElement.contentEditable.plaintext-only51121365.1511365
contenteditable.plaintext-only51121365511364.2