# jsTree v.1.0 - cookies plugin

## Description

The `cookies` enables jstree to save the state of the tree across sessions. What this does is save the opened and selected nodes in a cookie, and reopen & reselect them the next time the user loads the tree. Depends on the jQuery.cookie plugin.

## Configuration

### save_opened

A string (or `false`). Default is `"jstree_open"`.

The name of the cookie to save opened nodes in. If set to `false` - opened nodes won't be saved.

### save_selected

A string (or `false`). Default is `"jstree_select"`.

The name of the cookie to save selected nodes in. If set to `false` - selected nodes won't be saved.

### auto_save

A Boolean. Default is `true`.

If set to `true` jstree will automatically update the cookies every time a change in the state occurs.

### cookie_options

An object. Default is `{}`.

The options accepted by the jQuery.cookie plugin.

## Demos

Check your data plugin documentation (html_data, xml_data, json_data) or take a close look at these examples for information on how to specify multilanguage nodes.

### Using the cookies plugin

Go ahead and make changes to the tree and then refresh this page.

- Root node 1
  - Child node 1
  - Child node 2
- Root node 2

## API

### .save_cookie ( event )

Save the current state.

- `string` event

  Used internally with the `auto_save` option. Do not set this manually.