title: Set caret position in a content editable element
body: <p>I'd like to set caret position in a content editable element but it seem's not working.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var el = document.getElementsByTagName('div')[0];
  var range = document.createRange();
  var sel = window.getSelection();
  range.setStart(el, 2);
  range.collapse(true);
  sel.removeAllRanges();
  sel.addRange(range);
  el.focus();</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div contenteditable&gt;Hi ! How are you doing ?&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>