I have the following:
<div contenteditable="true">
<p>Here is some text blah <span class="tag">meme</span> hello world.</p>
</div>
What I want to do is set the cursor after the span. I can use the following but this doesn't let me tell the cursor to go after the span:
var sel = window.getSelection();
var textNode = document.getElementById("comment_content_new").firstChild;
var range = document.createRange();
range.setStart(textNode, 7);
range.collapse(true);
sel.removeAllRanges();
sel.addRange(range);
Any ideas how I can tell var textNode to go after the span?
Thanks
The easiest way would be with jquery