title: Onclick javascript cookie
body: <p>I have created a content locker(click link to open content) but now I am stuck on the cookie part. Once you've clicked the particular link the content locker must not appear again for 30 days. I have created the onclick cookie and it works, but I can't seem to be able to set the number of days the cookie must remain(whatever I do its set as a session cookie) and I also don't know how to read the cookie on pageload so that it doesn't show the content locker again. I am not a javascript expert at all, everything i've managed so far is from googling. Here's my code</p>
  
  <pre><code>myDate = new Date('31/12/2020 12:00 UTC');
  document.cookie = 'clicklink=yes; expires=' + myDate.toString + ';';
  </code></pre>
  
  <p>onclick="alert(document.cookie);"></p>
  
  <p>Please help</p>