First of all, the title is the same as this question: JavaScript Set Window selection
But that question is badly titled since he wants to know how to select or clear the current selection, the answer was how to clear the selection.
The question is, using java-script how can I dynamically/programmatically create a selection on an element (div, p, b, etc.)? Basically how can you dynamically highlight a text inside an element?
There are many answer on how to highlight all text of a particular element, but there are no answer on how to highlight specific text of an element.