title: Jquery - get array of checkbox values
body: <p>I have a few checkboxes with the <code>name="location[]"</code> and each checkbox has a different value <code>value="3"</code> or <code>value="5"</code> etc. I am wondering how in jquery when these boxes are checked to put the value inside an array called <code>location[]</code> ? Here is my html:</p>
  
  <pre><code>&lt;ul id="searchFilter"&gt;
  &lt;li class=""&gt;&lt;input type="checkbox" name="location[]" class="cb_location" value="1"&gt;Toronto&lt;/li&gt;
  &lt;li class=""&gt;&lt;input type="checkbox" name="location[]" class="cb_location" value="3"&gt;New York&lt;/li&gt;
  &lt;li class=""&gt;&lt;input type="checkbox" name="location[]" class="cb_location" value="6"&gt;London&lt;/li&gt;
  &lt;li class=""&gt;&lt;input type="checkbox" name="location[]" class="cb_location" value="5"&gt;Paris&lt;/li&gt;
  &lt;li class=""&gt;&lt;input type="checkbox" name="location[]" class="cb_location" value="4"&gt;Berlin&lt;/li&gt;             
  &lt;/ul&gt;
  </code></pre>
  
  <p>and heres what I got as far a jquery:</p>
  
  <pre><code>var $checkboxes = $("input:checkbox");
  var opts = [];
  $checkboxes.each(function(){
       if(this.checked){
       opts.push(this.name);
  }
  </code></pre>
  
  <p>this returns just <code>location[]</code> and adds another <code>location[]</code> when I check another item.</p>
  
  <p>Please help.</p>
  
  <p>I also have other checkboxes with price[], sqft[]...I am looking to keep the checkboxes in the same ground, so arrays inside 1 array...i hope that makes sense.</p>