Entering elements into a ContentEditable div that cannot be deleted

Say you have a div like:

<div contenteditable="true" droppable="true" id="editor"> <span draggable="true" contenteditable="false" id="tag-0">0</span> This <span draggable="true" contenteditable="false" id="tag-1">1</span> will be the editor. </div> 

The two spans "tag-0" and "tag-1" represent tags that must be interleaved between div text. The user should be able to drag them, but not delete them . Is there a good way to do this?

+4
source share
1 answer

Not quite sure what you are trying to achieve, but it looks like you can use jQuery drag and drop functions.

Here's a link. http://jqueryui.com/draggable/

First, check out the demo to see if you want it. If this is then great, as it is easy to do with jQuery.

0
source

Source: https://habr.com/ru/post/1490794/


All Articles