Index, by my definition is, the numbers indicate the position order of elements within a container.
In this code, the id blinking represents the node where the caret is. the id blinking has index of 2 inside body container.
What I am trying to archive is, when I open a working document, I want the caret to be exact position when I left off.
To do so I need to store the words offset and the node which contain the caret, but the node returned by selection.anchorNode is an object, we can't store object in database. Therefore, we need to get the index value of the node. so that we can do something like this
Back to my question, how do we capture index of the node where the caret is ?
sel.collapse(content.childsNode, 23);// put the caret at fifth node, offset 23 characters