HTML global attribute contenteditable

The contenteditable attribute is new in HTML5 and allows the user to change the content in the page.

The following example shows how to use contenteditable attribute.

What's new in HTML5

The contenteditable attribute is new in HTML5.


<element contenteditable="true|false">

Attribute Values

set element to editable
set element to not editable

Browser compatibility

contenteditable Yes Yes Yes Yes Yes


   <p contenteditable="true">It is  raining right  now</p>

Click to view the demo

The code above applies the contenteditable attribute to a p element.

Setting the attribute value to true allows the user to edit the element contents, and setting it to false disables this feature.

If you don't specify a value, the element inherits the setting for this property from its parent.

The user clicks on the text and starts to type.