title: Saving JQuery Toggle State with Cookie
body: <p>I've got an iFrame that is toggled either visible or hidden on button click. I'm using the JQuery .toggle function to do this. Currently the div for the area is hidden by default through CSS: style="display:none"</p>
  
  <p>A new requirement has come in asking that the user's most recent show or hide (the selected toggle-state) be saved for the next page load, so if they chose to show the iFrame last time they were at the home page, the next time they visited it would be visible by default. I want to set the last selected toggle state with a cookie, but I can't get it to work.  Below is my code:</p>
  
  <pre><code>&lt;meta charset="utf-8"&gt;
  &lt;title&gt;drop demo&lt;/title&gt;
  &lt;link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"&gt;
  &lt;style&gt;
    #toggle {
      width: 100px;
      height: 100px;
      background: #ccc;
    }
    .button {
      padding-top: 10px;
      padding-right: 20px;
    }
  &lt;/style&gt;
  &lt;script src="//code.jquery.com/jquery-1.10.2.js"&gt;&lt;/script&gt;
  &lt;script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"&gt;&lt;/script&gt;
  &lt;button type="button" id="button"
  title="Personalized Sales Dashboard"&gt;Show/Hide&lt;/button&gt;
  &lt;div id="toggle" style="display:none" frameborder="2"&gt;
  &lt;iframe src="https://sample.com"="" id="myfr" scrolling="no" frameborder="0"
   height="800px" width="100%"&gt;Your Browser Do not Support Iframe&lt;/iframe&gt;
  &lt;/div&gt;
  &lt;script&gt;
    $("#button").click(function () {
      $("#toggle").toggle("blind");
    });
    $(function () {
      $("#button").tooltip();
    });
  &lt;/script&gt;
  </code></pre>