Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
看起来它允许您编辑元素的内容,但实际发生了什么?这个属性有什么用?
编辑:见这里
这通常用于富文本输入。虽然像常规表单元素一样<input type="text"/>不提供真正的富文本编辑选项,但contentEditable设置为的元素true可以。大多数可用于 Web 的富文本编辑器(例如 FCK 编辑器)都是使用<iframe/>with contentEditableset to构建的true。
<input type="text"/>
contentEditable
true
<iframe/>
contentEditable=truefor 元素使它们可编辑。您可以在这些元素中编写/编辑文本,就好像它们是文本区域或文本字段一样。
contentEditable=true