title: How to use localstorage to store all checkbox boolean values in a list to an array?
body: <p>The code looks like this:</p>
  
  <pre><code>&lt;div id="list"&gt;
    &lt;input type="checkbox" id="1"&gt;
    &lt;input type="checkbox" id="2"&gt;
    &lt;input type="checkbox" id="3"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>In another html pane (a separate template), I want to store all those checkbox (<code>checked</code>/<code>unchecked</code>) booleans into an array. What I did looks like:</p>
  
  <pre><code>var array = [];
  var checkboxli = document.getElementsByTagName("input");
  for (var i = 0; i &lt; checkboxli.length; i++)
  {
    array.push($("#input.prop('checked')"));
  }
  </code></pre>
  
  <p>However, this doesn't work. I have other templates using tag name "<code>input</code>", so I need to limit the tag name to the ones under <code>"#list"</code> id (some sort of css selector perhaps). Currently, both <code>document.getElementsByTagName("input")</code> and <code>$("#input.prop('checked')")</code> won't work. There might be other syntax problems. Please help me resolve. Thanks.</p>
  
  <p>EDIT: It seems like I didn't communicate my intention well. Here is what I want to get out of the list:
  An array that looks like</p>
  
  <pre><code>[true, false, true, true, true...]
  </code></pre>
  
  <p>in which each boolean value represents whether the corresponding input checkbox is checked or not.</p>