The code below is what I use now, just to set the cursor position to the tail of span
var node = document.getElementById("span_first");
var range = document.createRange();
range.setStartAfter(node);
var sel = window.getSelection();
range.collapse(true);
sel.removeAllRanges();
sel.addRange(range);
http://jsfiddle.net/vXnCM/3837/
But I want to set the cursor position at any place in the span, how can I do?
Thanks you.