Answer the question
In order to leave comments, you need to log in
How in contenteditable to prevent deletion of an element and make a paragraph wrap?
There is an empty <div contenteditable="true"></div>
. When reloading the page, I insert a paragraph inside using JS <p></p>
. Everything would be fine, but when editing the text and completely deleting all objects inside <p></p>
, they are no longer created.
Therefore, the question is this. How to prevent the complete removal of all elements inside the contenteditable, or how to set the default value when even the cursor is inside?
Frameworks, etc. not to offer, as I am writing for the sake of study and practice, I want to understand, but for three days I have not been able to find the truth. Thanks in advance.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question