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.
The contenteditable
attribute is new in HTML5.
<element contenteditable="true|false">
contenteditable |
Yes | Yes | Yes | Yes | Yes |
<!DOCTYPE HTML>
<html>
<body>
<p contenteditable="true">It is raining right now</p>
</body>
</html>
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.