The HTMLElement.contentEditable property is used to indicate whether or not the element is editable. This enumerated attribute can have the following values:

  • "true" indicates that the element is contenteditable.
  • "false" indicates that the element cannot be edited.
  • "inherit" indicates that the element inherits its parent's editable status.

You can use the HTMLElement.isContentEditable property to test the computed Boolean value of this property.

Syntax

editable = element.contentEditable
element.contentEditable = "true"

Specifications

Specification Status Comment
WHATWG HTML Living Standard
The definition of 'contenteditable' in that specification.
Living Standard Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 11 3.0 (1.9) 6[1] 10.6 3.2
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 3 1.0 (1.9) 6[1] Not supported 5

[1] Internet Explorer has a bunch of bugs regarding the implementation of this feature. IE10 crashes in some cases when editing lists (bug 796187). IE11+ uses invalid positioning for caret when an element is floated (bug 858749). In IE9-10 the window freezes when using mousewheel while dragging (bug 809254). IE10-11 does not fire the input event (bug 794285). IE10 crashes after selecting "Cut" from the context menu (bug 801770). IE11+ does not allow placing the caret in an empty table cell (bug 807199). IE10 does not fire contextmenu event when right-clicking on misspelled words (bug 774350). IE11 appends <br> elements to <body> when showing/hiding an <iframe> with contenteditable document inside (bug 864804). IE11 does not allow disabling resize handles for images/inputs (bug 907422).

See also

Document Tags and Contributors

Last updated by: Sebastianz,
Hide Sidebar