让div可编辑

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

contenteditable: "inherit";(默认)  
contenteditable: "plaintext-only";(输入纯文本)  
contenteditable: "true";  
contenteditable: "false";  
contenteditable: "caret";(符号) 

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://blog.csdn.net/ning0_o/article/details/50905722

猜你喜欢

转载自www.cnblogs.com/adolphRe/p/9187480.html