I usually use this to match elements heights:
function equalHeight(group) {
tallest = 0;
group.each(function() {
thisHeight = $(this).height();
if(thisHeight > tallest) {
tallest = thisHeight;
}
});
group.height(tallest);
}
$(function() {
equalHeight($('.column'));
});
However, in my case I need to match elements to their nearest sibling not by class, with the following example
<div class="post">
<div class="leftCol">
<h2>This is a post headline</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volut</p>
</div>
<div class="rightCol">
<ul>
<li></li>
</ul>
</div>
</div><!--/post-->
There will be multiple (over 15) instances per page of this structure. I don't want to match the height of ".leftCol" to the height of ".rightCol" across the board - that is I don't want every ".leftCol" to match every ".rightCol" on the page, just within each ".post" group - match ".leftCol" height to its immediate sibling of the ".rightCol" class... any ideas?