title: Twitter Bootstrap. Remember alert close action
body: <p>I've tried to remember the close action in Twitter's Bootstrap alerts following this post (<a href="https://stackoverflow.com/questions/13408244/using-bootstrap-have-alert-box-remember-close-action">Using Bootstrap, have alert box remember close action</a>)</p>
  
  <p>I want users can not see the alert once they have closed it and the page reloads again.</p>
  
  <p>I know that i must to store the status into a cookie, so I used the JQuery function suggested in the above example, but is not working. What am I doing wrong?</p>
  
  <p>Fiddle ->  <a href="http://jsfiddle.net/kFy5y/" rel="nofollow noreferrer">http://jsfiddle.net/kFy5y/</a></p>
  
  <p>Thanks in advance!!</p>
  
  <pre><code>jQuery(function( $ ){
  
      // Check if alert has been closed
      if( $.cookie('alert-box') === 'closed' ){
  
          $('.alert').hide();
  
      }
  
       // Grab your button (based on your posted html)
      $('.close').click(function( e ){
  
          // Do not perform default action when button is clicked
          e.preventDefault();
  
          /* If you just want the cookie for a session don't provide an expires
           Set the path as root, so the cookie will be valid across the whole site */
          $.cookie('alert-box', 'closed', { path: '/' });
  
      });
  
  });
  </code></pre>
  
  <p>Alert</p>
  
  <pre><code>&lt;div class="alert alert-info fade in"&gt;            
              &lt;button type="button" class="close" data-dismiss="alert"&gt;×&lt;/button&gt;
              &lt;strong&gt; ALERT BODY&lt;/strong&gt;
  &lt;/div&gt;
  </code></pre>