The setStart()
and setEnd()
methods of DOM Range are well specified, so you could find the answer by reading the spec or MDN.
To summarise, if you want to specify a range boundary in terms of character offsets, you need to deal with a text node rather than an element. If your element contains a single text node, changing the first line of your code to the following will work:
var node = document.getElementById("content").firstChild;