title: jquery function: same height for specific elements?
body: <p>hey guys,
  i did the following function in order to have the same height for specific elements on my webpage.</p>
  
  <pre><code>    var max_height = 0;
      function widgetsSameHeight( elements ) {
          elements.each(function(){
               if($(this).height() &gt; max_height){
                  max_height = $(this).height();   
              }
          });
  
          elements.height(max_height);
      }
  
      widgetsSameHeight( $('#group1 .widget-container') );
  </code></pre>
  
  <p>However if I apply this function to two groups of elements of the same page ALL elements get the same height. However each group should have the same max-height. e.g.</p>
  
  <pre><code>widgetsSameHeight( $('#group1 .widget-container') );
  widgetsSameHeight( $('#group2 .widget-container') );
  </code></pre>
  
  <p>In this case the highest element sets the height for each element in group1 and group2. However I need to have all elements in group1 to have the height of its highest element. And the same height for all elements in group2 depending on the highest element in group2.</p>
  
  <p>I think you know what I mean, my explanation is rather bad :)</p>
  
  <p>any idea how I could solve that or what I'm doing wrong here?</p>