So I have this scenario
<div id="editor" contenteditable="true">
<div id="list">Hello</div>
</div>
I want to call
var html = $('<div id="replaced" contenteditable="false">Hello</div>');
$('#list').replaceWith(html);
The problem is I want the output to be like this:
<div id="editor" contenteditable="true">
<div id="replaced" contenteditable="false">Hello</div><br />
</div>
I tried the following and it didn’t work: (Where this is the div replacing tmp.mention)
$('#'+tmp.mention).replaceWith(this).parent().after('<br />');
I want to do this because the div replacing tmp.mention has contenteditable set to false inside a div editor that has a contenteditable set to true. If there’s no
the user will not be able to type after the div…
Try this:
I think you need
DEMO
But if you want to whole
#editorthenDEMO
According to edit
If you want output like
then try