English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML tag大全

HTML contenteditable attribute

The global attribute contenteditable is an enumerated attribute that indicates whether an element can be edited by the user. If it can, the browser will modify the element's components to allow editing.

HTML Global Attributes

Online Example

An editable paragraph:

!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>HTML contenteditable attribute usage (Basic Tutorial Website oldtoolbag.com)/title>
</head>
<body>
<p contenteditable="true">I am an editable text.</p>
</body>
</html>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the contenteditable attribute

Definition and Usage

The contenteditable attribute specifies whether the element content is editable.

Note: If the contenteditable attribute is not set on an element, it will inherit it from its parent element.

HTML 4.01 with HTML5differences

The contenteditable attribute is a new addition to HTML.

Syntax

<element contenteditable="true|false">

Attribute Value

ValueDescription
trueThe specified element is editable
falseThe specified element is not editable
HTML Global Attributes