The isContentEditable
property returns
whether the content of an element is editable or not.
This property is read-only.
isContentEditable |
Yes | Yes | Yes | Yes | Yes |
HTMLElementObject.isContentEditable
A Boolean type, 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.
<!DOCTYPE html>
<html>
<body>
<p id="myP" contenteditable="true">editable</p>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!--from www .ja va 2 s . c om-->
var x = document.getElementById("myP").isContentEditable;
console.log(x);
}
</script>
</body>
</html>
The code above is rendered as follows: