Set Div Height to Another Div Height

I know similar questions have been asked and I have referenced them, but have yet to get this to work. I have an aside that may not have as much content as the main section next to it. I am using the load event window.load to run my script called asideHeightSet below is the snippet that calls it:


        asideHeightSet("main_content_aside", "main_content_section");

I have other functions that are executing fine from there and this snippet is after I can any dependent jQuery libraries. My javascript for the asideHeightSet is:

var $ = function (id) { return document.getElementById(id); }
function asideHeightSet(aside, section){
var sectionHeight = $(section).style.height;
$(aside).style.height= sectionHeight;


I ran the firebug debugger in firefox and it keeps on showing that the height of the section is blank it outputs "" in the watch when I step through.

Any help would be appreciated.


This did it for me:

function asideHeightSet(aside, section){ var sectionHeight = $(section).offsetHeight-22;

$(aside).style.height = sectionHeight+"px";


the 22 was to take into account for padding and border of aside.


Running the code you provided lets me get the height of the elements with


style height returns none because probably there are no height css style associated with the element. Try it and tell me what the results are.

Need Your Help

Date minus date query

sql sql-server date

I have a query like shown below and I want to make calculation for end_scan-packing_date column, how can I achieve this?

WCF TLS cipher suite

.net wcf security

I have a requirement to specify the cipher suite to be used for transport level security on a