state()


Save, load or clear saved states. See Using States for more info.

Syntax
Selectable.state([command])

The method accepts a single argument as a String and can be the following:

  • "save" - saves the current selection.
  • "undo" - moves back to the last selection
  • "redo" - restores the last undone selection
  • "clear" - removes all saved selections.

Demo

    You can also use ctrl + z to undo a selection and ctrl + y to restore / redo an undone selection.