HTML DOM contentEditable property
Examples
Settings <p> element content to be edited:
document.getElementById ( "myP") contentEditable = true.;
try it"
Definitions and use
Whether the content contentEditable property sets or returns an element editable.
Tip: You can also use isContentEditable property to see if the content of the element can be edited.
Browser Support
Figures in the table represent the first browser to support the property version number.
Attributes | |||||
---|---|---|---|---|---|
contentEditable | 11.0 | 5.5 | 3.0 | 3.2 | 10.6 |
grammar
Back contentEditable properties:
HTMLElementObject .contentEditable
Setting contentEditable properties:
HTMLElementObject .contentEditable = true | false
Property Value
value | description |
---|---|
true | false | Whether the description element editable. Possible values:
|
technical details
return value: | Boolean value, if the element is editable returns true, false otherwise |
---|
More examples
Examples
See <p> element can be edited:
var x = document.getElementById ( "myP") contentEditable.;
x The output is:
true
try it"
Examples
Switching <p> element in edit mode:
var x = document.getElementById ( "myP");
if (x.contentEditable == "true") {
x.contentEditable = "false";
button.innerHTML = "p element content can edit! ';
} Else {
x.contentEditable = "true";
button.innerHTML = "p element content can not be edited!";
}
if (x.contentEditable == "true") {
x.contentEditable = "false";
button.innerHTML = "p element content can edit! ';
} Else {
x.contentEditable = "true";
button.innerHTML = "p element content can not be edited!";
}
try it"
Related Pages
HTML Reference Manual: HTML contenteditable attribute