{{HTMLSidebar("Global_attributes")}}
The contenteditable
global attribute is an enumerated attribute indicating if the element should be editable by the user. If so, the browser modifies its widget to allow editing. The attribute must take one of the following values:
- true or the empty string, which indicates that the element must be editable;
- false, which indicates that the element must not be editable.
If this attribute is not set, its default value is inherited from its parent element.
This attribute is an enumerated one and not a Boolean one. This means that the explicit usage of one of the values true, false or the empty string is mandatory and that a shorthand like <label contenteditable>Example Label</label>
is not allowed. The correct usage is <label contenteditable="true">Example Label</label>
.
Specifications
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', "editing.html#attr-contenteditable", "contenteditable")}} | {{Spec2('HTML WHATWG')}} | No change from latest snapshot, {{SpecName('HTML5.1')}} |
{{SpecName('HTML5.1', "editing.html#attr-contenteditable", "contenteditable")}} | {{Spec2('HTML5.1')}} | Snapshot of {{SpecName('HTML WHATWG')}}, no change from {{SpecName('HTML5 W3C')}} |
{{SpecName('HTML5 W3C', "editing.html#attr-contenteditable", "contenteditable")}} | {{Spec2('HTML5 W3C')}} | Snapshot of {{SpecName('HTML WHATWG')}}, initial definition. |
Browser compatibility
{{ CompatibilityTable() }}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{ CompatVersionUnknown() }} | {{ CompatGeckoDesktop("1.9") }} | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | {{ CompatVersionUnknown() }} | {{ CompatGeckoMobile("1.9") }} | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} | {{ CompatVersionUnknown() }} |
See also
- All global attributes.
- {{domxref("HTMLElement.contentEditable")}} and {{domxref("HTMLElement.isContentEditable")}}