jQuery(window).load(function(){ // Compare heights of #sidebar and #content var $sidebar = jQuery("#sidebar"); var $content = jQuery("#content"); if(!$sidebar || !$content) { return; } var heightSidebar = $sidebar.height(); var heightContent = $content.height(); if(heightContent > heightSidebar) { $sidebar.height(heightContent); } else { $content.height(heightSidebar); } });