使用contentEditable时阻止编辑某些元素

时间:2013-03-27 12:50:24

标签: html html5

在下面的示例标记中,使用html5 contentEditable="true"时,<span id="cookie">是否有某种方法可以编辑?

<div contentEditable="true">
    This text be edited. <span id="nodelete">Except for this text.</span> This can be edited as well.
</div>

1 个答案:

答案 0 :(得分:1)

好的,根据无位请求:

我将使用的解决方案是将内部span声明为内联div,但将contentEditable设置为false,就像这样......

<div contentEditable="true">
    This text be edited. <div style="display: inline;" contentEditable="false">Except for this text.</div> This can be edited as well.
</div>