i suppose this question is rather old and had been answered numerous times but i just couldn't find where. so here is the question:
i have
PHP Code:
  function storeCaret (textEl) {
       if (
textEl.createTextRange
         
textEl.caretPos document.selection.createRange().duplicate();
     }
     function 
insertAtCaret (textEltext) {
       if (
textEl.createTextRange && textEl.caretPos) {
         var 
caretPos textEl.caretPos;
         
caretPos.text =
           
caretPos.text.charAt(caretPos.text.length 1) == ' ' ?
             
text ' ' text;
       }
       else
         
textEl.value  text;
     } 
i want to write a function that inserts some text and poses a caret after that when i click on the image