title: Display Modal Window once every 3 days with cookie
body: <p>I am trying to add carhartl's <a href="https://github.com/carhartl/jquery-cookie" rel="nofollow">jquery.cookie.js</a> script to my <a href="http://tympanus.net/codrops/2013/06/25/nifty-modal-window-effects/" rel="nofollow">modal script</a> so that I can have the modal show only if a user has not been there/seen the modal for 3 days or if the user has recently cleared there cache.</p>
  
  <p>Here's what I have so far...</p>
  
  <p>This code currently launches my modal by auto clicking the button to launch the modal window and works perfectly. <i>(I know there might be a way to re-work this so that it just auto-loads the modal without need for a button, so if you can help me re-work that part I would appreciate it, also.)</i></p>
  
  <pre><code>&lt;div style="visibility:hidden;"&gt;
     &lt;button class="md-trigger" id="modal11" data-modal="modal-11"&gt;&lt;/button&gt;
  &lt;/div&gt;
  
  &lt;script&gt;
  jQuery(function(){
     jQuery('#modal11').click();
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>But when adding the script the add a cookie to my modal, i seem to run into an issue, please view the code below and see where I am going wrong...</p>
  
  <pre><code>&lt;div style="visibility:hidden;"&gt;
     &lt;button class="md-trigger" id="modal11" data-modal="modal-11"&gt;&lt;/button&gt;
  &lt;/div&gt;
  
  &lt;script&gt;
     $(document).ready(function() {
        if ($.cookie('modal_shown') == null) {
           $.cookie('modal_shown', 'yes', { expires: 3, path: '/' });
           $('#modal11').click();
        }
     });
  &lt;/script&gt;
  </code></pre>
  
  <p>Thanks in advance for any assistance you can provide on this, I really appreciate your help! ;-)</p>
  
  <hr>
  
  <p>here are my updates, based on @zigdawgydawg's help... but it's still not functioning for me...</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function() {
     $('#modal11').click(function();
  });
  
  console.log($.cookie('modal_shown'));
     if ($.cookie('modal_shown') == null) {
        console.log('creating cookie');
     $.cookie('modal_shown', 'yes', { expires: 365, path: '/' });
     $('#modal11').click();
  
  }
  console.log($.cookie('modal_shown'));
  });
  &lt;/script&gt;
  </code></pre>