title: How to retrieve all jQuery multi-select values
body: <p>I'm trying to access a jQuery multi-select thing from my JavaScript code and am getting myself terribly confused. This simple example works fine, alerting with a comma-separated list of the checked items:</p>
  
  <p><a href="http://jsfiddle.net/smontanaro/d0Laxh6j/" rel="nofollow">http://jsfiddle.net/smontanaro/d0Laxh6j/</a></p>
  
  <p>Those values are produced with this bit:</p>
  
  <pre><code>$('[name=offset]').val()
  </code></pre>
  
  <p>but I don't understand the magic it invokes under the covers. Consequently, I'm having trouble generalizing that to a more useful example.</p>
  
  <p>Consider a slightly different environment. I have a callback function with this structure:</p>
  
  <pre><code>function respond(button) {
      var form = button.form;
      ...
  }
  </code></pre>
  
  <p>which is called from HTML like so:</p>
  
  <pre><code>&lt;input type="button" value="Submit" onclick="respond(this); return false;"&gt;
  </code></pre>
  
  <p>If I use something like this:</p>
  
  <pre><code>var group = form.elements["offset"].value;
  </code></pre>
  
  <p>all I get is the first checked value. So, I've got my button and its form. As I understand it, neither are jQuery-specific objects, just plain old JavaScript objects. How do I get from them to a comma-separated string (or better yet, a list of strings) of checkbox values like the simple jsfiddle example yields?</p>