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.caretPos document.selection.createRange().duplicate();
insertAtCaret (textEltext) {
       if (
textEl.createTextRange && textEl.caretPos) {
caretPos textEl.caretPos;
caretPos.text =
caretPos.text.charAt(caretPos.text.length 1) == ' ' ?
text ' ' text;
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