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 GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
isContentEditable |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
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.
Voir aussi
element.contentEditable
- L'attribut global
contenteditable
.