title: Caret position in textarea in IE using jQuery caret plugin
body: <p>I'm using this <a href="http://www.jquery-plugin.buss.hk/my-plugins/jquery-caret-plugin" rel="nofollow">plguin</a> to get caret position of textarea. I have a <code>&lt;div&gt;</code>, clicking on which shows the <code>&lt;ul&gt;</code>with smilie list to put one of them into the textarea. Clicking on <code>&lt;div&gt;</code> fires the <code>blur</code> event on textarea. I save the caret position on blur:</p>
  
  <pre><code>oRoot.blur(function() {
      caret_pos = $(this).caret();
  });
  </code></pre>
  
  <p>And after user click on smilie, I put it in the textarea where the caret was before it lost the focus:</p>
  
  <pre><code>oList
      .delegate('.chat-smile', 'click', function() {
          var oRoot = $(this).parent().data('oRoot');
  
          if (is_default_value(oRoot)) oRoot.val('');
  
          oRoot.val(oRoot.caret(caret_pos).caret().replace($(this).attr('smilie-code')));
  
          toggle_list($(this).parent());
      });
  </code></pre>
  
  <p>The problem is that in IE it seems that the plugin doesn't work if textarea has no focus, and in IE the <code>blur</code> event handler is fired after the focus is lost.</p>
  
  <p>Any ideas of workaround this? I was thinking of saving the caret position on <code>click</code>, <code>keyup</code>, <code>focus</code> for IE..</p>