Save Selected Text Range for Use Later Not working
I am using contenteditable and highlighting some text. I want to then backup that text range, and at a later time give that range(text) a different color. If I check in my zss_editor.restorerange method I do get back a valid selection object, so it must be something incorrect in how I am previously saving that range. var zss_editor = {}; // The current selection zss_editor.currentSelection; zss_editor.backuprange = function(){ var selection = window.getSelection(); zss_editor.currentSelection = selection.getRangeAt(0); zss_editor.currentSelection.setEnd(zss_editor.currentSelection