jQuery: Save an array of elements to cookie
<p>I'm making a jquery plugin to create 'spindowns', you can locate the project at <a href="http://github.com/c00lryguy/jquery.spindown.js" rel="nofollow">http://github.com/c00lryguy/jquery.spindown.js</a></p>

<p>The plugin works perfectly, but the only way I could figure out how to save which elements were expanded was to save an array filled with the expanded elements inner text.</p>

<p>Now, there are obvious downfalls to this. For instance, if two elements have the same text and one is expanded and the other wasn't, when it loads it from a cookie, it will think both of them were expanded.</p>

<p>Is there a good way to save an array of elements to a cookie?</p>

<h2>Edit</h2>

<p><hr></p>

<p>No no, you guys don't seem to understand. Saving to a cookie works perfectly fine. And not all of the elements have IDs. Take this example: </p>

<pre><code>$('.expandable').spindown();
</code></pre>

<p><hr></p>

<pre><code>&lt;div class="expandable"&gt;First spindown&lt;/div&gt;
&lt;div&gt;Content&lt;/div&gt;
&lt;ul&gt;
    &lt;li class="expandable"&gt;Second spindown&lt;/div&gt;
    &lt;img src="someimg.jpg"&gt;&lt;/img&gt;
&lt;/ul&gt;
</code></pre>

<p>Now, when a user clicks the div containing "First spindown", the div containing "Content" would slide down. And when a user clicks the li containing "Second spindown", the img element underneath it would slide down, kinda like an accordion.</p>

<p>This is because it finds the element with the "expandable" class and makes it clickable, toggling the slide effect for the next logical element.</p>

<p>Now, I have the code finding which elements were expanded, adding the elements inner text to an array, and saving that array to a cookie. Then when a user goes back to the page, it just expands the ones in that array stored in the cookie since that was the only way I could figure out how to save which elements were expanded in the cookie.</p>
