title: Using Bootstrap, have alert box remember close action
body: <p>I am trying to create a Bootstrap alert box that remembers when users click the close button. I guess I need to store that information in a cookie. Ideally that cookie will only last for that current session, and next they return the box will appear again.</p>
  
  <p>I am using the jQuery-Cookie plugin. I uploaded it to <code>/jquery-cookie-master</code>. Plugin can be <a href="https://github.com/carhartl/jquery-cookie" rel="nofollow noreferrer">found here</a>. </p>
  
  <p>This is what I've got so far by following code <a href="https://stackoverflow.com/questions/10151605/using-twitter-bootstrap-how-can-you-remember-user-actions">found here</a>.</p>
  
  <pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="/jquery-cookie-master/jquery.cookie.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      function runOnLoad(){
          if($.cookie('alert-box') == null) {
              $.cookie('alert-box', 'open', { expires: 7 });
          } else if($.cookie('alert-box') == 'close') {
              $(".close").hide();
          }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;body onload="runOnLoad()"&gt;
  
  &lt;div class="alert alert-info"&gt;
    &lt;button type="button" class="close" data-dismiss="alert" href="hideMe.php" onclick="hideMe()"&gt;×&lt;/button&gt;
    &lt;p&gt;
      &lt;strong&gt;FORUM UPGRADE:&lt;/strong&gt; In light of our recent surge in popularity we upgraded our forum and unfortunately lost all the old threads in the process.
    &lt;/p&gt;
    &lt;p&gt;
      In an effort to kick-start the forum again we need your help. Sign up now and leave a post (it's free). Once we reach 100 threads every member will receive a special gift.
    &lt;/p&gt;
    &lt;p&gt;
      &lt;a href="http://example.com/forum/#/entry/register"&gt;
        &lt;strong&gt;Sign up to the forum now&lt;/strong&gt;
      &lt;/a&gt;.
    &lt;/p&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p>Unfortunately it's not working.When I click the close button it does not remember that action and if I refresh the page the alert box will appear again.</p>
  
  <p>What have I done wrong?</p>