title: jQuery - Calculate minWidth
body: <blockquote>
    <p><a href="http://jsfiddle.net/kkBRE/1/" rel="nofollow">View jsFiddle</a></p>
  </blockquote>
  
  <p>Attempting to set the <code>min-Width</code> of a <code>&lt;menu&gt;</code> by calculating the total width of all the <code>&lt;command&gt;</code> elements inside of the <code>&lt;menu&gt;</code>. I tried my best to figure it out in the following <code>jQuery</code>:</p>
  
  <pre><code>$(document).ready(function() {
      $('menu').each(function() {
  
          var minWidth;
  
          $('menu command').each(function() {
              minWidth = minWidth + $(this).outerWidth(); 
          });
  
          $(this).css('min-width', minWidth);
      });
  });
  </code></pre>
  
  <p>This is the format for the <code>HTML</code>:</p>
  
  <pre><code>&lt;menu&gt;
      &lt;command class="less" /&gt;
      &lt;command class="more" /&gt;
  
      &lt;div class="space"&gt;&lt;/div&gt;
  
      &lt;command class="save" /&gt;
      &lt;command class="vote" /&gt;
      &lt;command class="send" /&gt;
  &lt;/menu&gt;
  </code></pre>
  
  <blockquote>
    <p>The <code>div.space</code> is just a seperator that I'm going to code later to split the commands across the full length.</p>
  </blockquote>
  
  <p>My code currently comes up with no errors.</p>
  
  <blockquote>
    <p><a href="http://jsfiddle.net/kkBRE/1/" rel="nofollow">View jsFiddle</a></p>
  </blockquote>