Advertisement
Home Open Editor ❯

HTML contenteditable Attribute

Example

<h1 contenteditable="false">This is an uneditable Heading.</h1>
<p contenteditable="true">This is an editable paragraph.</p>

Try this code ❯

Meaning

The contenteditable attribute allows users to directly edit content in a browser.

A value of false prevents content from being edited by users; true allows editing.

If this attribute is missing or its value is invalid, its value is inherited from its parent element: so the element is editable if its parent is editable.

Note: That although its allowed values include true and false, this attribute is an enumerated one and not a Boolean one.


Standard Syntax

<element contenteditable="true|false">


Applies to:

The contenteditable attribute can be used on the following element:

Element Attribute
All HTML elements contenteditable

Advertisement

Attribute Values

Value Description
true (It can be empty string)Specifies the element is editable.
false Specifies the element is not editable
Home Open Editor ❯
Advertisement