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.

HTMLElement.isContentEditable は読み取り専用のプロパティで、論理値であり、要素の内容が編集可能な場合は true を返します。それ以外の場合は false を返します。

論理値です。

HTML

html
<p id="firstParagraph">編集不可能な段落</p>
<p id="secondParagraph" contenteditable="true">編集可能な段落</p>

<p id="infoText1">最初の段落を編集できますか?</p>
<p id="infoText2">2 番目の段落を編集できますか?</p>

JavaScript

js
const firstParagraph = document.getElementById("firstParagraph");
const secondParagraph = document.getElementById("secondParagraph");

const infoText1 = document.getElementById("infoText1");
const infoText2 = document.getElementById("infoText2");

infoText1.textContent += " " + firstParagraph.isContentEditable;
infoText2.textContent += " " + secondParagraph.isContentEditable;

結果

仕様書

Specification
HTML
# dom-iscontenteditable-dev

ブラウザーの互換性

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

関連情報