JavaScript element.isContentEditable Property
You are Here:
JavaScript element.isContentEditable Property
The element.isContentEditable
property returns a Boolean value indicates whether the contents of the element are editable or not.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<p contenteditable="true">Edit this paragraph.</p>
<button onclick="myFunction()">Disable Editing</button>
<p id="point"></p>
<script>
var x = document.getElementById("point");
var btn = document.getElementsByTagName("button")[0];
var elem = document.getElementsByTagName("p")[0];
function myFunction(){
if(elem.isContentEditable){
elem.contentEditable = "false";
btn.innerHTML = "Enable Editing";
}
else{
elem.contentEditable = "true";
btn.innerHTML = "Disable Editing";
}
}
</script>
</body>
</html>
Syntax
element.isContentEditable
Return Values
Value | Explanation |
---|---|
true | The content of the element can be edited. |
false | The content of the element cannot be edited. |
Reminder
Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in JavaScript.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.