HTMLElement.isContentEditable

The HTMLElement.isContentEditable read-only property returns a boolean value 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

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
isContentEditable
1
12
4
5.5
≤12.1
3
4.4
18
4
≤12.1
1
1.0

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/isContentEditable