title: Age Verification Popup: Set cookie to remember decision
body: <p>I am using the following code to display an age verification popup on a cigarette website:</p>
  
  <pre class="lang-javascript prettyprint-override"><code>$(function() {
    $('[data-popup-close]').on('click', function(e) {
      var targeted_popup_class = jQuery(this).attr('data-popup-close');
      $('[data-popup="' + targeted_popup_class + '"]').fadeOut(350);
      e.preventDefault();
    });
  });
  </code></pre>
  
  <p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
  <div class="snippet-code snippet-currently-hidden">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>// Popup Age Verification
  $(function() {
    $('[data-popup-close]').on('click', function(e) {
      var targeted_popup_class = jQuery(this).attr('data-popup-close');
      $('[data-popup="' + targeted_popup_class + '"]').fadeOut(350);
      e.preventDefault();
    });
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#popup {
      z-index: 1000;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      position: fixed;
      background-color: rgba(0, 0, 0, 0.8);
  }
  
  .verify-window {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 300px;
      height: 200px;
      margin-left: -150px;
      margin-top: -100px;
      overflow: hidden;
      border-radius: 10px;
      padding: 20px;
      background-color: #fff;
      box-sizing: border-box;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  }
  
  .verify-window img {
      display: block;
      width: 250px;
      height: 50px;
      margin: 0 auto;
      padding: 20px;
  }
  
  .verify-window h3 {
      font-family: 'Roboto', sans-serif;
      font-size: 1em;
      color: #4d4d4d;
      line-height: 1.7;
      margin-top: 10px;
      text-align: center;
  }
  
  .verify-window p {
      font-family: 'Roboto', sans-serif;
      font-size: 1em;
      color: #4d4d4d;
      margin-top: 10px;
      line-height: 1.7;
      text-align: center;
  }
  
  .button-yes,
  .button-no {
      background: #fff;
      color: #ADCC21;
      width: 20%;
      margin-top: 10px;
      border: 2px solid #ADCC21;
      padding: 12px 17px;
      border-radius: 30px;
      font-family: 'Roboto', sans-serif;
      text-align: center;
      font-size: 1em;
  }
  
  .button-no {
      float: right;
      margin-right: 20px;
      border: 2px solid #95969a;
      color: #95969a;
      display: block;
  }
  
  .button-yes {
      float: left;
      margin-left: 20px;
  }
  
  .button-yes:hover {
      background: #ADCC21;
      color: #fff;
      transition: all 0.2s ease;
      cursor: pointer;
  }
  
  .button-no:hover {
      background: #95969a;
      color: #fff;
      transition: all 0.2s ease;
      cursor: pointer;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="popup" data-popup="popup-1"&gt;
      &lt;div class="verify-window"&gt;
          &lt;h3&gt;Age Verification&lt;/h3&gt;
          &lt;p&gt;Are you at least 18 years old?&lt;/p&gt;
  
          &lt;div class="button-yes" data-popup-close="popup-1"&gt;
              Yes
          &lt;/div&gt;
  
          &lt;a href="https://www.google.com" target="_parent"&gt;
              &lt;div class="button-no"&gt;
                  No
              &lt;/div&gt;
          &lt;/a&gt;
      &lt;/div&gt;&lt;!-- // verify window --&gt;
  &lt;/div&gt;
  
  &lt;div id="content"&gt;
      &lt;p&gt;Page Content&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><sup>(Code source: <a href="https://jsfiddle.net/xfk4m0xg/1/" rel="nofollow noreferrer">jsfiddle.net</a>)</sup></p>
  
  <p>I want to implement a cookie that remembers when the user clicks on the <code>.button-yes</code> button. The other button shouldn't have a feature like this. How can I realize it the best way?</p>