Element isContentEditable Property - Javascript DOM

Javascript examples for DOM:Element isContentEditable


The isContentEditable property returns whether the content of an element is editable.

This property is read-only.

Return Value

A Boolean, returns true if the content of an element is editable, otherwise it returns false

The following code shows how to check if a <p> element is editable or not:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<p id="myP" contenteditable="true">Click the button to find out if I am editable.</p>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

function myFunction() {//from ww w. ja v  a  2  s  .  com
    var x = document.getElementById("myP").isContentEditable;
    document.getElementById("demo").innerHTML = x;


Related Tutorials