toggle()


/**
 * @param  {Mixed} item
 * @param  {Boolean} bool
 * @return {Boolean}
 */
selectable.toggle(choice, bool)

Toggles the state of the given item(s)


The first argument is the item(s) you want to toggle:

  • HTMLElement

  • HTMLCollection

  • NodeList

  • Number - the index of the selectable element in the items array

  • Object - a reference to the item stored in the items array

  • Array - an array of HTMLElement, indexes or item references

The second optional argument accepts a boolean to force the selected state.


Last updated