I have the following JS that inserts some content into a textarea at the end of whatever is in the textarea currently. This all works fine with the following code:
<script>
if (opener.document.post.sMessage.createTextRange && opener.document.post.sMessage.caretPos) {
var caretPos = opener.document.post.sMessage.caretPos;
caretPos.text = '\n\n';
} else {
opener.document.post.sMessage.value += '\n\n';
}
self.close(); //close popup
</script>
How can this be modified to insert the content into the textarea where the cursor was in the textarea (instead of just at the end of the existing text)?