--- title: Save the state in javascript tree layout: page js: examples/save_state.js css: example.css ---

Example 4 - Save the state

If you set the option saveState to true, then jqtree remembers the tree state after a page reload.

html

{% highlight html %}
{% endhighlight %}

javascript

{% highlight js %} $('#tree1').tree({ saveState: true }); {% endhighlight %}

Giving the saveState a string value sets the storage key. The default key is 'tree'.

{% highlight js %} $('#tree1').tree({ saveState: 'my-tree' }); {% endhighlight %}