title: How to save dynamically added checkbox value in localStorage?
body: <p>I want to save my checkbox value dynamically. When i check a specific one , all checkboxes are checked.Used target  but did not work. Any ideas?
  <a href="https://jsfiddle.net/Lq0w7w9j/" rel="nofollow">JSFIDDLE</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> var data = localStorage.getItem("checkbox");
      if (data) {
         $("input[name='checkbox-name']").attr("checked", "checked");
      }
      
    $(document).on('change', "input[name='checkbox-name']", function (e) {
       var target = $(e.target );
      if (target.is(":checked")) {
          localStorage.setItem("checkbox", 1);
      } else {
           localStorage.removeItem("checkbox");
      }
  });</code></pre>
  </div>
  </div>
  </p>