概述

HTMLElement.contentEditable 属性用于表明元素是否是可编辑的。该枚举属性(enumerated attribute)可以具有下面的几种值之一:

  • "true" 表明该元素可编辑。
  • "false" 表明该元素不可编辑。
  • "inherit" 表明该元素继承了其父元素的可编辑状态。

语法

editable = element.contentEditable
element.contentEditable = "true"

规范

Specification Status Comment
HTML Living Standard
contenteditable
Living Standard  
 

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 11 3.0 (1.9) 6 10.6 3.2
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 3 1.0 (1.9) 6 未实现 5

Bugs

相关链接

 

文档标签和贡献者

 此页面的贡献者: AlexChao, teoli, AshfaqHossain, ziyunfei
 最后编辑者: AlexChao,