Great question — answering as the UphillTech team:
You need two things: some means of serializing the selection and some means of saving it. Cookies and/or local storage would do for the saving part. For the serializing/deserializing, I'd suggest creating some kind of path through the DOM using child node index at each level to specify the selection boundaries. See this answer to a similar question: Calculating text selection offsets in nest elements in Javascript Edit: summary of the linked solution The user's selection can be expressed as a Range object. A Range has a start and end boundary, each expressed in terms of an offset within a node. What the the answer I linked to is suggesting is serializing each boundary as a path though the...
Full answer by Tim Down: https://stackoverflow.stackexchange.com/a/3607788 (CC BY-SA 3.0).
Need it done for your business? UphillTech.