I am trying to develop online chat window. For this I opted for content editable div for sending and receiving messages. I have written javascript to add the image when the user clicks on image.
Here the problem is after we click on image it was added into div, but the caret position was before the image. Below is the source code of addImage() method.
Code:
function addImage(obj) {
var divContent1 = document.getElementById("TextEditor").innerHTML;