Set the content of a <p> element to be editable:
More "Try it Yourself" examples below.
The contentEditable property sets or returns whether the content of an element is editable or not.
Tip: You can also use the isContentEditable property to find out if the content of an element is editable or not.
The numbers in the table specifies the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
contentEditable | 11.0 | 5.5 | 3.0 | 3.2 | 10.6 |
Return the contentEditable property:
Set the contentEditable property:
Value | Description |
---|---|
true|false |
Specifies whether the content of an element should be editable. Possible values:
|
Return Value: | A Boolean, returns true if the element is editable, otherwise it returns false |
---|
Find out if a <p> element is editable or not:
The result of x will be:
Toggle between the ability to edit the content of a <p> element:
HTML reference: HTML contenteditable attribute