The isContentEditable property returns whether the content of an element is editable or not.
Find out if a <p> element is editable or not:
var x = document.getElementById("myP").isContentEditable;
<!DOCTYPE html> <html> <body> <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> <script> function myFunction() {/* w ww . ja v a2s. c o m*/ var x = document.getElementById("myP").isContentEditable; document.getElementById("demo").innerHTML = x + " = The p element is editable."; } </script> </body> </html>
This property is read-only.
We can use the contentEditable property to change the editable state of an element.
The isContentEditable property returns true if the content of an element is editable, otherwise it returns false.