Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try this jQuery Plugin: <a href="https://github.com/carhartl/jquery-cookie" rel="nofollow">https://github.com/carhartl/jquery-cookie</a> It's a simple, lightweight jQuery plugin for reading, writing and deleting cookies.</p> <p>You can simply <strong>create</strong> Cookies</p> <pre><code>$.cookie('the_cookie', 'the_value'); </code></pre> <p>And <strong>read</strong> Cookies</p> <pre><code>$.cookie('the_cookie'); // =&gt; 'the_value' </code></pre> <p>So you <strong>ask for</strong> it...</p> <pre><code>if ($.cookie('the_cookie') === 'the_value') { $('#someid1').addClass('open'); } </code></pre> <p><strong>CSS</strong></p> <pre><code>#someid1 { display:none; } #someid1.open { display:block } </code></pre> <p><strong>Example Implemtation</strong></p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html lang="en-US"&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;title&gt;&lt;/title&gt; &lt;!-- Get jQuery Core --&gt; &lt;script src="/path/to/jquery.js" type="text/javascript"&gt;&lt;/script&gt; &lt;!-- Get Cookie Plugin --&gt; &lt;script src="/path/to/jquery.cookie.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; // Is DOM ready? $(document).ready(function() { $('#hide').click(function(e){ // Set Cookie named 'notification'to the value 'hide' $.cookie('notification', 'hide'); // Hide your Div $('#someid1').slideUp('slow'); // Disable default behavior e.preventDefault(); }); // Hide DIV is Cookie is Set if( $.cookie('notification') === 'hide' ){ $('#someid1').hide(); } }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="someid1"&gt; &lt;div id="someid2"&gt;some gibberish&lt;/div&gt; &lt;a id="hide" href="#"&gt;HERE&lt;/a&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>Note:</strong> This code is not tested and might not be work. But it gives you a hint to the right direction.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload