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
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>
JavaScript
document.getElementById('infoText1').innerHTML += document.getElementById('myText1').isContentEditable; document.getElementById('infoText2').innerHTML += document.getElementById('myText2').isContentEditable;
Result
Specifications
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. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
isContentEditable | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE ? | Opera Full support Yes | Safari Full support 6 | WebView Android Full support 4.4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown
See also
HTMLElement/contentEditable
- The
contenteditable
global attribute.