The HTMLElement.isContentEditable
read-only property returns a Boolean
that is true
if the contents of the element are editable; otherwise it returns false
.
editable = element.isContentEditable
document.getElementById("infoText1").innerHTML += document.getElementById("myText1").isContentEditable; document.getElementById("infoText2").innerHTML += document.getElementById("myText2").isContentEditable;
<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>
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'HTMLElement.contenteditable' in that specification. | Living Standard | No change from latest snapshot, HTML 5.1 |
HTML 5.1 The definition of 'HTMLElement.contenteditable' in that specification. | Recommendation | Snapshot of HTML Living Standard, no change from HTML5 |
HTML5 The definition of 'HTMLElement.contenteditable' in that specification. | Recommendation | Snapshot of HTML Living Standard, initial definition. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | ? | Yes | 1 | ? | ? | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes | Yes | Yes | 4 | ? | ? | ? |
element.contentEditable
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/isContentEditable