Set cursor at the end of content editable
<p>I have a simple content editable that contains text with tags... when a tag is inserted the word is replaced with a span inside it...</p>

<pre><code>&lt;div contenteditable=true&gt;
      text text text &lt;span class="tag"&gt;tag&lt;/span&gt; 
&lt;/div&gt;
</code></pre>

<p>This is the result (when user press space the tag is replaced with a span containing the tag's text; this happens on keyup)</p>

<p>Then I need to place the cursor at the end of the content editable (outside the span) in order to let the user continue typing...</p>

<p>I've been able to move the cursor at the end but only inside the span...</p>

<p>I use rangy.</p>