This page is In Progress

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

isContentEditable

Property of dom/HTMLElementdom/HTMLElement

Syntax

var result = element.isContentEditable;
element.isContentEditable = value;

Examples

The following example shows how to use the isContentEditable property to determine whether the user can edit the content of an object.

<head>
<SCRIPT>
function chgSpan() {
    currentState = oSpan.isContentEditable;
    newState = !currentState;
    oSpan.contentEditable = newState;
    oCurrentValue.innerText = newState;
    newState==false ? oBtn.innerText="Enable Editing" :
        oBtn.innerText="Disable Editing"
}
</SCRIPT>
</head>
<body onload="oCurrentValue.innerText = oSpan.isContentEditable;">
<P>Click the button to enable or disable SPAN content editing.</P>
<P>
<BUTTON ID="oBtn" onclick="chgSpan()">Enable Editing</BUTTON>
</P>
<P><SPAN ID="oSpan">You can edit this text.</SPAN></P>
Span can be edited: <SPAN ID="oCurrentValue"></SPAN>
</body>

View live example

Syntax

Attributions