I am making a project where users can click on the smileys and they get inserted in contenteditable div.
- I want three divs and in whatever div I am, the smiley should insert in that div.
- Also, here the problem is that smileys only insert at the end of the div. I want that smiley should enter only wherever is the cursor.
Note: please check that the size of smileys should remain same in all the divs.
<div id="text_wrapper">
<div id="text" contentEditable="true" hidefocus="true"></div>
</div>
<div id="text_wrapper">
<div id="text1" contentEditable="true" hidefocus="true"></div>
</div>
<div id="text_wrapper">
<div id="text2" contentEditable="true" hidefocus="true"></div>
</div>
<span id="button">Add Emoji</span>
$("#button").click(function() {
$("#text").append('<img src="https://cdn.okccdn.com/media/img/emojis/apple/1F60C.png"/>');
});