HTMLElement.isContentEditable - Web APIs 编辑
The HTMLElement.isContentEditable
read-only property returns a Boolean
that is true
if the contents of the element are editable; otherwise it returns false
.
Syntax
editable = element.isContentEditable
Example
HTML
<p id="myText1">Uneditable Paragraph</p>
<p id="myText2" contentEditable="true">Editable Paragraph</p>
<p id="infoText1">Can edit the first paragraph? </p>
<p id="infoText2">Can edit the second paragraph? </p>
JavaScript
document.getElementById('infoText1').innerHTML += document.getElementById('myText1').isContentEditable;
document.getElementById('infoText2').innerHTML += document.getElementById('myText2').isContentEditable;
Result
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'HTMLElement.contenteditable' in that specification. | Living Standard | No change from latest snapshot, HTML 5.1 |
HTML 5.1 The definition of 'HTMLElement.contenteditable' in that specification. | Recommendation | Snapshot of HTML Living Standard, no change from HTML5 |
HTML5 The definition of 'HTMLElement.contenteditable' in that specification. | Recommendation | Snapshot of HTML Living Standard, initial definition. |
Browser compatibility
BCD tables only load in the browser
See also
HTMLElement/contentEditable
- The
contenteditable
global attribute.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论