I have a div tag with contenteditable set to true. I want the user to be able to edit the text inside that div, but not remove any additional div or span tags inside. For example with the following code.
<div class="container" contenteditable="true">
This Content Should be Editable
<span contenteditable="false"
style="display: inline;">
This Should not be Editable</span>
</div>
I have the desired result in the span tag when I set its contenteditable to false. But when i press backspace in the div tag i am also able to remove the whole span tag. I want to lock the span tag in the div, like dont allow the user to remove it or edit it. For now I think having a contenteditable div tag is allowing the user to remove the span completely. Is there a work around to achieve this. And I donot want to have the editable text in another span.