title: Turning HTML <dl> into a nested JavaScript array with jQuery
body: <p>I have an HTML definition list, and I want to use jQuery to turn that into a nested JavaScript array. What's the simplest way to do this? Thanks for your help.</p>
  
  <p>My input looks like this:</p>
  
  <pre><code>&lt;dl&gt;
    &lt;dt&gt;A&lt;/dt&gt;
     &lt;dd&gt;A1&lt;/dd&gt;
    &lt;dt&gt;B&lt;/dt&gt;
     &lt;dd&gt;B1&lt;/dd&gt;
     &lt;dd&gt;B2&lt;/dd&gt;
  &lt;/dl&gt;
  </code></pre>
  
  <p>I want my output to look like this:</p>
  
  <pre><code>[['A', 'A1'], ['B', 'B1', 'B2']]
  </code></pre>