YouTip LogoYouTip

Prop Html Contenteditable

# HTML DOM contentEditable Property [![Image 3: HTML Element Object Reference](#) Element Object](#) ## Example Set the content of the

element to be editable: document.getElementById("myP").contentEditable = true; [Try it Β»](#) * * * ## Definition and Usage The contentEditable property is used to set or return whether the content of an element is editable. **Tip:** You can also use the (#) property to check if the content of an element is editable. * * * ## Browser Support The numbers in the table specify the first browser version that fully supports the property. | Property | | | | | | | --- | --- | --- | --- | --- | --- | | contentEditable | 11.0 | 5.5 | 3.0 | 3.2 | 10.6 | * * * ## Syntax Return the contentEditable property: _HTMLElementObject_.contentEditable Set the contentEditable property: _HTMLElementObject_.contentEditable=true|false ## Property Values | Value | Description | | --- | --- | | true|false | Describes whether the content of the element is editable. Possible values: * inherit - Default. If the parent element is editable, the content of the child element is also editable. * true - The content is editable * false - The content is not editable | ## Technical Details | Return Value: | A Boolean. Returns true if the element is editable, otherwise false | | --- | * * * ## More Examples ## Example Check if the

element is editable: var x = document.getElementById("myP").contentEditable; The output of _x_ will be: true [Try it Β»](#) ## Example Toggle the edit state of the

element: var x = document.getElementById("myP"); if (x.contentEditable == "true") { x.contentEditable = "false"; button.innerHTML = "p element content is editable!"; } else { x.contentEditable = "true"; button.innerHTML = "p element content is not editable!"; } [Try it Β»](#) * * * ## Related Pages HTML Reference: (#) * * Element Object](#)

← Prop Html IscontenteditableMet Document Queryselector β†’