summaryrefslogtreecommitdiff
path: root/devdocs/html/global_attributes%2Fcontenteditable.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/html/global_attributes%2Fcontenteditable.html')
-rw-r--r--devdocs/html/global_attributes%2Fcontenteditable.html80
1 files changed, 80 insertions, 0 deletions
diff --git a/devdocs/html/global_attributes%2Fcontenteditable.html b/devdocs/html/global_attributes%2Fcontenteditable.html
new file mode 100644
index 00000000..b12e08ee
--- /dev/null
+++ b/devdocs/html/global_attributes%2Fcontenteditable.html
@@ -0,0 +1,80 @@
+<header><h1>contenteditable</h1></header><div class="section-content"><p>The <code>contenteditable</code> <a href="../global_attributes">global attribute</a> is an enumerated attribute indicating if the element should be editable by the user. If so, the browser modifies its widget to allow editing.</p></div>
+<h2 id="try_it">Try it</h2>
+<div class="section-content">
+<iframe class="interactive is-tabbed-shorter-height" height="200" src="https://interactive-examples.mdn.mozilla.net/pages/tabbed/attribute-contenteditable.html" title="MDN Web Docs Interactive Example" loading="lazy"></iframe> <p>The attribute must take one of the following values:</p> <ul> <li>
+<code>true</code> or an <em>empty string</em>, which indicates that the element is editable.</li> <li>
+<code>false</code>, which indicates that the element is not editable.</li> <li>
+<code>plaintext-only</code>, which indicates that the element's raw text is editable, but rich text formatting is disabled.</li> </ul> <p>If the attribute is given without a value, like <code>&lt;label contenteditable&gt;Example Label&lt;/label&gt;</code>, its value is treated as an empty string.</p> <p>If this attribute is missing or its value is invalid, its value is <em>inherited</em> from its parent element: so the element is editable if its parent is editable.</p> <p>Note that although its allowed values include <code>true</code> and <code>false</code>, this attribute is an <em><a href="https://developer.mozilla.org/en-US/docs/Glossary/Enumerated">enumerated</a></em> one and not a <em>Boolean</em> one.</p> <p>You can set the color used to draw the text insertion <a href="https://developer.mozilla.org/en-US/docs/Glossary/Caret">caret</a> with the CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/caret-color"><code>caret-color</code></a> property.</p> <p>Elements that are made editable, and therefore interactive, by using the <code>contenteditable</code> attribute can be focused. They participate in sequential keyboard navigation. However, elements with the <code>contenteditable</code> attribute nested within other <code>contenteditable</code> elements are not added to the tabbing sequence by default. You can add the nested <code>contenteditable</code> elements to the keyboard navigation sequence by specifying the <code>tabindex</code> value (<a href="tabindex"><code>tabindex="0"</code></a>).</p>
+</div>
+<h2 id="specifications">Specifications</h2>
+<div class="_table"><table class="standard-table">
+<thead><tr><th scope="col">Specification</th></tr></thead>
+<tbody><tr><td><a href="https://html.spec.whatwg.org/multipage/interaction.html#attr-contenteditable">HTML Standard <br><small># attr-contenteditable</small></a></td></tr></tbody>
+</table></div>
+<h2 id="browser_compatibility">Browser compatibility</h2>
+<div class="_table"><table>
+<thead>
+<tr id="bct-browser-type">
+<th></th>
+<th colspan="6">Desktop</th>
+<th colspan="6">Mobile</th>
+</tr>
+<tr id="bct-browsers">
+<th></th>
+<th>Chrome</th>
+<th>Edge</th>
+<th>Firefox</th>
+<th>Internet Explorer</th>
+<th>Opera</th>
+<th>Safari</th>
+<th>WebView Android</th>
+<th>Chrome Android</th>
+<th>Firefox for Android</th>
+<th>Opera Android</th>
+<th>Safari on IOS</th>
+<th>Samsung Internet</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<th><code>contenteditable</code></th>
+<td class="bc-supports-yes">1</td>
+<td class="bc-supports-yes">12</td>
+<td class="bc-supports-yes">3</td>
+<td class="bc-supports-yes">5.5</td>
+<td class="bc-supports-yes">9</td>
+<td class="bc-supports-yes">≤4</td>
+<td class="bc-supports-yes">4.4</td>
+<td class="bc-supports-yes">18</td>
+<td class="bc-supports-yes">4</td>
+<td class="bc-supports-yes">14</td>
+<td class="bc-supports-yes">≤3.2</td>
+<td class="bc-supports-yes">1.0</td>
+</tr>
+<tr>
+<th><code>plaintext-only</code></th>
+<td class="bc-supports-yes">51</td>
+<td class="bc-supports-yes">≤79</td>
+<td class="bc-supports-no">No</td>
+<td class="bc-supports-no">No</td>
+<td class="bc-supports-yes">38</td>
+<td class="bc-supports-yes">Yes</td>
+<td class="bc-supports-yes">51</td>
+<td class="bc-supports-yes">51</td>
+<td class="bc-supports-no">No</td>
+<td class="bc-supports-yes">41</td>
+<td class="bc-supports-yes">Yes</td>
+<td class="bc-supports-yes">5.0</td>
+</tr>
+</tbody>
+</table></div>
+<h2 id="see_also">See also</h2>
+<div class="section-content"><ul> <li>All <a href="../global_attributes">global attributes</a>
+</li> <li>
+<a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/contentEditable"><code>HTMLElement.contentEditable</code></a> and <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/isContentEditable"><code>HTMLElement.isContentEditable</code></a>
+</li> <li>The CSS <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/caret-color"><code>caret-color</code></a> property</li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event">HTMLElement <code>input</code> event</a></li> </ul></div><div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 2005&ndash;2023 MDN contributors.<br>Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.<br>
+ <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/contenteditable" class="_attribution-link">https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/contenteditable</a>
+ </p>
+</div>