HTMLElement.contentEditable

The contentEditable property of the HTMLElement interface specifies 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

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
contentEditable
1
12
3
5.5
9
3
4.4
18
4
10.1
1
1.0

In Internet Explorer, contenteditable cannot be applied to the <table>, <col>, <colgroup>, <tbody>, <td>, <tfoot>, <th>, <thead>, and <tr> elements directly. A content editable <span> or <div> element can be placed inside the individual table cells.

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/contentEditable