HTMLElement.isContentEditable

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

La propriété en lecture seule HTMLElement.isContentEditable renvoie un booléen qui est true (vrai) si le contenu de l'élément est éditable ; sinon elle renvoie false (faux).

Syntaxe

js
editable = element.isContentEditable;

Exemple

JavaScript

js
document.getElementById("infoText1").innerHTML +=
  document.getElementById("myText1").isContentEditable;
document.getElementById("infoText2").innerHTML +=
  document.getElementById("myText2").isContentEditable;

HTML

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>

Résultat

Spécifications

Specification
HTML
# dom-iscontenteditable-dev

Compatibilité des navigateurs

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
isContentEditable

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Voir aussi