0
I have the following code Jsfiddle
It creates a div that gives to insert information and that when calling the contextmenu with the direct button opens a box to insert an image.
My question is:
How do I make him create the tag <image>
dynamically at the time I select to insert the image, without jquery or any pure javascript-only plugin?
In part:
<div class="div-text" oncontextmenu="contextMenu(); return false;" contentEditable="true">
<img src="" height="200" alt="Visualisar...">
</div>
Edited:
Next I made a new one, now I can create a new element as soon as I right click, here is the example:
This solution is very interesting, just need to do a . each, but if I put the
<image>
in any editable tag, the user will be able to delete that tag.– Wagner Viana
@Wagnervian where did you want to put the image to preview? wouldn’t it be within the editable divide?
– Sergio
that’s right, but maybe trade it for a
<textarea>
, because if I create the element, direct, it can be deleted even before being used.– Wagner Viana