Element contentEditable Property - Find out if a <p> element is editable or not: - Javascript DOM

Javascript examples for DOM:Element contentEditable

Description

Element contentEditable Property - Find out if a <p> element is editable or not:

Demo Code

ResultView the demo in separate window

<!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() {/*from w w  w .j  a v  a 2s . c  om*/
    var x = document.getElementById("myP").contentEditable;
    document.getElementById("demo").innerHTML = x ;
}
</script>

</body>
</html>

Related Tutorials