An element's isContentEditable
property, in browsers which support it, tells you whether the immediate child content of the element is editable. It applies specifically to regular non-interactive content (i.e. not form controls), which can be made editable using the contenteditable
attribute:
<div contenteditable="true">This text is all <i>editable</i></div>
The isContentEditable
property of both the <div>
and the <i>
elements above will report true
. However, be aware that not every browser that supports contentEditable
also supports isContentEditable
: Firefox 3.x, for example, supports contentEditable
but not isContentEditable
.
contenteditable
is standardized in HTML5 but has been around for over a decade. It was first introduced in IE 5.5 in 2000 and eventually made its way into other browsers several years later. Firefox has had it since version 3.0 (although it had the document-wide equivalent designMode
since pre-1.0) and Safari since (I think) 2.0.
Here's a good summary of the history of contentEditable: http://blog.whatwg.org/the-road-to-html-5-contenteditable