Я хочу обернуть выделенный текст в контейнер div с помощью span, возможно ли это?
Пользователь выберет текст и нажмет кнопку, при нажатии кнопки мыши я хочу обернуть выбранный текст элементом span. Я могу получить выделенный текст с помощью window.getSelection()
, но как узнать его точное положение в структуре DOM?