[英]Cover spans with a transparent div / image
I want to make the contents of a content-editable div non-editable. 我想使内容可编辑div的内容不可编辑。 Let's say I have a structure like: 假设我有一个类似的结构:
<div contenteditable=true></div>
Now with some functionality the the structure will become 现在有了一些功能,结构将变为
<div contenteditable=true> <p class="x">abc</p> some text <p
class="x">abc</p><p class="x">abc</p><p class="x">abc</p> again
editable continues</div>
I want to make the div partially non-editable (starting form first <p>
tag to last <p>
tag, so I decided to cover them with a transparent div. This works fine if the <p>
tags are in continuation but if there is some text in between them, it is editable (it is not covered by transparent div). 我想使div部分不可编辑(从第一个<p>
标记开始到最后一个<p>
标记,所以我决定用透明的div覆盖它们。如果<p>
标记连续,但是如果它们之间有一些文本,它是可编辑的(透明div并不覆盖)。
Is there any solution to cover some content of content editable div with transparent div or to make it partially non-editable? 有什么解决方案可以用透明div覆盖内容可编辑div的某些内容或使其部分不可编辑吗?
Note: I don't want to wrap all <p>
tags with any other element. 注意:我不想将所有<p>
标记与其他任何元素包装在一起。
您可以执行相反的操作-设置div contenteditable=false
并用contenteditable=true
将可编辑区域包裹在范围内
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.