title: Jquery cookie save selection of multiple <select>
body: <p>Seems like this has been asked multiple times in the past but the questions go unanswered for some reason.</p>
  
  <p>I'm trying to save the selection of multiple  inputs. I'm using this code which I found here on stackoverflow but it only saves the first select.</p>
  
  <pre><code>$(function() {
    if($.cookie('remember_select') != null) {
      $('.select_class option[value="' + $.cookie('remember_select') + '"]').attr('selected', 'selected');
    }
    $('.select_class').change(function() {
      $.cookie('remember_select', $('.select_class option:selected').val(), {expires: 365, path: '/'});
    });
  });
  </code></pre>
  
  <p>Thanks</p>
  
  <p>Here is the working soltuion I came up with...</p>
  
  <pre><code>&lt;select class="select_class" id="foo" name="foo"&gt;
    &lt;option value="1"&gt;1&lt;/option&gt;
    &lt;option value="2"&gt;2&lt;/option&gt;
  &lt;/select&gt;
  
  $(function(){                                                                                      
      var selectbox=$('#setup').find('.select_class'), selectboxCookieName='selection';
          selectbox.each(function(){
          $(this).prop('value', $.cookie(selectboxCookieName + '|' + this.name));
      });
  
      selectbox.change(function(){
          if(this.value){
              $.cookie(selectboxCookieName + '|' + this.name, this.value,{
                  expires: 365
              });
          }else{
              $.removeCookie(selectboxCookieName + '|' + this.name);
          }
      });
  });
  </code></pre>