让div可编辑,设置标签的可读可写属性

1、添加contenteditable属性让文本处于可编辑状态,<p contenteditable="true">这里可以编辑</p>

contenteditable: "inherit";(默认)
contenteditable: "plaintext-only";(输入纯文本)
contenteditable: "true";
contenteditable: "false";
contenteditable: "caret";(符号)
contenteditable: "events";(不知道搞啥用的)

2、利用css的user-modify

user-modify: read-only;
user-modify: read-write;
user-modify: write-only;(暂不支持)
user-modify: read-write-plaintext-only;(输入纯文本,暂时只有谷歌支持:
-webkit-user-modify: read-write-plaintext-only)


原文地址:https://www.cnblogs.com/Zting00/p/7497701.html