Html – How to get the start index of a selected text within a multiline text of a div?
Assume I have an editable div which contains these lines: How to retrieve the position of 'w' in the text ? I can't use: window.getSelection().anchorOffset; Because this gets the position in the line, but not in text, that is 0…