I would like to get the cursor position and set the value to a hidden form input. Then after posting to PHP get that value and use it to set the cursor position.
I've been looking and can't figure out how this would be done, any help is appreciated.
I've been looking and can't figure out how this would be done, any help is appreciated.
Re: Save and Restore Cursor Position
Once you have the range you can query if it is a "hair"-cursor by asking:
if it is collapsed then the range.startContainer is the domElement and the range.startOffset is the text-position inside this element (if it is a textElement). If range.startContainer is NOT a textElement then range.startOffset is the child number of the range.startContainer -element.
Save these variables and set them again. Once the range is created use the range.select() to apply the selection on the editor
Re: Save and Restore Cursor Position