How can create a Selection in the browser in JavaScript?

31 views Asked by At

The Selection API allows me to get the current selection with window.getSelection() and edit the selection with

selection.modify('extend', 'backward', 'character');

to, for example, go back a character.

But how can I actually select text with the selection API?

0

There are 0 answers