title: Getting checkbox id out of local storage for with JQuery
body: <p>I am working on a form that on reload has to save and show the marked checkboxes,
  i made the code that can save it in to local storage but now i don't know how to get the id's of the checkboxes out of the local storage so they will be checkt again on reloading the page.</p>
  
  <p>Here is a  <a href="https://jsfiddle.net/jpn05aky/" rel="nofollow">JSFiddle</a></p>
  
  <p>The code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>// this code saves the marked checkbox in the local storage
  
  $('.required-option').on('click', function() {
    var fav, favs = [];
    $('.required-option').each(function() { // run through each of the checkboxes
      fav = {
        id: $(this).attr('id'),
        value: $(this).prop('checked')
      };
      if (fav.value === true) {
        favs.push(fav.id);
      }
    });
    localStorage.setItem("checkbox", JSON.stringify(favs));
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input type="checkbox" class="required-option" id="like1" /&gt;
  &lt;input type="checkbox" class="required-option" id="like2" /&gt;
  &lt;input type="checkbox" class="required-option" id="like3" /&gt;
  &lt;input type="checkbox" class="required-option" id="like4" /&gt;
  &lt;input type="checkbox" class="required-option" id="like5" /&gt;
  &lt;input type="checkbox" class="required-option" id="like6" /&gt;
  &lt;input type="checkbox" class="required-option" id="like7" /&gt;
  &lt;input type="checkbox" class="required-option" id="like8" /&gt;
  &lt;input type="checkbox" class="required-option" id="like9" /&gt;</code></pre>
  </div>
  </div>
  </p>