In JavaScript, there is a method window.getSelection(), that lets me get the current selection that the user has made.
Is there a corresponding function, something like window.setSelection(), that will let me set, or clear, the current selection?
Maybe this will do it:
Crossbrowser version: