The HTMLElement.isContentEditable
read-only property returns a Boolean
that is true
if the contents of the element are editable; otherwise it returns false
.
Syntax
editable = element.isContentEditable
Example
JavaScript
document.getElementById("infoText1").innerHTML += document.getElementById("myText1").isContentEditable; document.getElementById("infoText2").innerHTML += document.getElementById("myText2").isContentEditable;
HTML
<p id="myText1">Uneditable Paragraph</p> <p id="myText2" contentEditable="true">Editable Paragraph</p> <p id="infoText1">Can edit the first paragraph? </p> <p id="infoText2">Can edit the second paragraph? </p>
Result
Specifications
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of 'HTMLElement.contenteditable' in that specification. |
Living Standard | No change from latest snapshot, HTML5.1 |
HTML5.1 The definition of 'HTMLElement.contenteditable' in that specification. |
Recommendation | Snapshot of WHATWG HTML Living Standard, no change from HTML5 |
HTML5 The definition of 'HTMLElement.contenteditable' in that specification. |
Recommendation | Snapshot of WHATWG HTML Living Standard, initial definition. |
Browser compatibility
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | 4.0 (2) | (Yes) | (Yes) | (Yes) |
Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | (Yes) | 4.0 (2) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
See also
element.contentEditable
- The contenteditable global attribute.
Document Tags and Contributors
Tags:
Contributors to this page:
xrtariq2594,
erikadoyle,
fscholz,
teoli,
mnoorenberghe,
kscarfone,
Sheppy,
ethertank,
vali29
Last updated by:
xrtariq2594,