The contenteditable global attribute is an enumerated attribute indicating if the element should be editable by the user. If so, the browser modifies its widget to allow editing.

The attribute must take one of the following values:

  • true or the empty string, which indicates that the element must be editable;
  • false, which indicates that the element must not be editable.

If this attribute is not set, its default value is inherited from its parent element.

This attribute is an enumerated one and not a Boolean one. This means that the explicit usage of one of the values true, false or the empty string is mandatory and that a shorthand like <label contenteditable>Example Label</label> is not allowed. The correct usage is <label contenteditable="true">Example Label</label>.

You can set the color used to draw the text insertion caret with the CSS caret-color property.

Specifications

Specification Status Comment
HTML Editing APIs
The definition of 'contenteditable' in that specification.
Editor's Draft Adds "events", "caret", "typing", "plaintext-only"
HTML Living Standard
The definition of 'contenteditable' in that specification.
Living Standard No change from latest snapshot, HTML 5.2
HTML 5.2
The definition of 'contenteditable' in that specification.
Recommendation Snapshot of HTML Living Standard, no change from HTML 5.1
HTML 5.1
The definition of 'contenteditable' in that specification.
Recommendation Snapshot of HTML Living Standard, no change from HTML5
HTML5
The definition of 'contenteditable' in that specification.
Recommendation Snapshot of HTML Living Standard, initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support YesEdge Full support YesFirefox Full support 3IE Full support 5.5Opera Full support 9Safari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?
contenteditable="events"
Experimental
Chrome Full support YesEdge ? Firefox No support NoIE No support NoOpera ? Safari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android ?
contenteditable="caret"
Experimental
Chrome Full support YesEdge ? Firefox No support NoIE No support NoOpera ? Safari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android ?
contenteditable="typing"
Experimental
Chrome Full support YesEdge ? Firefox No support NoIE No support NoOpera ? Safari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android ?
contenteditable="plaintext-only"
Experimental
Chrome Full support YesEdge ? Firefox No support NoIE No support NoOpera ? Safari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

See also

Document Tags and Contributors

Last updated by: ExE-Boss,