HTMLElement.contentEditable
A propriedade HTMLElement.contentEditable
é usada para indicar se o elemento é editável ou não. Esse atributo enumerado pode ter os seguintes valores:
"true"
Indica que o elemento é editável;"false"
Indica que o elemento não pode ser editável;"inherit"
Indica que o elemento herda o status editável de seu pai.
Você pode usar a propriedade HTMLElement.isContentEditable
(en-US) para testar o valor calculado Boolean
(en-US) desta propriedade.
Sintaxe
editable = element.contentEditable element.contentEditable= "true"
Especificação
Especificação | Status | Comentário |
---|---|---|
HTML Living Standard The definition of 'contenteditable' in that specification. |
Padrão em tempo real | Initial definition |
Compatibilidade com navegadores
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 11 | 3.0 (1.9) | 6[1] | 10.6 | 3.2 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | 3 | 1.0 (1.9) | 6[1] | Não suportado | 5 |
[1] Internet Explorer has a bunch of bugs regarding the implementation of this feature. IE10 crashes in some cases when editing lists (bug 796187). IE11+ uses invalid positioning for caret when an element is floated (bug 858749). In IE9-10 the window freezes when using mousewheel while dragging (bug 809254). IE10-11 does not fire the input
event (bug 794285). IE10 crashes after selecting "Cut" from the context menu (bug 801770). IE11+ does not allow placing the caret in an empty table cell (bug 807199). IE10 does not fire contextmenu
event when right-clicking on misspelled words (bug 774350). IE11 appends <br>
elements to <body>
when showing/hiding an <iframe>
with contenteditable document inside (bug 864804). IE11 does not allow disabling resize handles for images/inputs (bug 907422).