最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - html5, what is isContentEditable? - Stack Overflow

programmeradmin12浏览0评论

chrome supports the isContentEditable property (lists it in the "Inspect Element"), but reports false for INPUT, FORM - actually, everything.

too me, for example, seems that INPUT, non-readonly, should be true.

does anybody know what's going on?

chrome supports the isContentEditable property (lists it in the "Inspect Element"), but reports false for INPUT, FORM - actually, everything.

too me, for example, seems that INPUT, non-readonly, should be true.

does anybody know what's going on?

Share Improve this question asked Sep 21, 2011 at 9:39 cc youngcc young 20.2k32 gold badges94 silver badges150 bronze badges 1
  • What is isContentEditable? – Alex Commented Sep 21, 2011 at 9:44
Add a ment  | 

2 Answers 2

Reset to default 10

isContentEditable doesn't have anything to do with forms and input boxes. It was designed to be a way to flag inline editable html content.

You can see a working example here: http://www.navioo./javascript/dhtml/isContentEditable_Example_4513.html

You can read about it

here: http://www.w3/TR/2009/WD-html5-20090423/editing.html

or: http://blog.whatwg/the-road-to-html-5-contenteditable

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/the-road-to-html-5-contenteditable

发布评论

评论列表(0)

  1. 暂无评论