contenteditable
HTML contenteditable Attribute (HTML contenteditable属性)
The HTML contenteditable attribute is used to specify whether or not the content of an element is editable. (HTML contenteditable属性用于指定元素的内容是否可编辑。)
You can use this attribute on any HTML element. It is a part of the Global Attributes. (您可以在任何HTML元素上使用此属性。它是全局属性的一部分。)
The contenteditable attribute can have two values: true (the content is editable) or false (the content is not editable). If this attribute is not set on an element, the element will inherit it if its immediate parent element is editable. (Contenteditable属性可以有两个值: true (内容可编辑)或false (内容不可编辑)。如果未在元素上设置此属性,则如果元素的直接父元素可编辑,则该元素将继承它。)
The contenteditable attribute does not have an effect on disabled elements. (> contenteditable属性对禁用的元素没有影响。)
Syntax
Syntax (语法)
<tag contenteditable = "true|false"></tag>
Example of the HTML contenteditable attribute:
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<p contenteditable="false">
This is a paragraph. It is not editable.
(这是一个段落。不可编辑。)
</p>
<p contenteditable="true">
This is a paragraph. It is editable. Try to change this text.
(这是一个段落。它是可编辑的。请尝试更改此文本。)
</p>
</body>
</html>