Reputation: 7030
Hi I have DIV structure something like this.
<div class="leftCol">
Left Col Content
</div>
<div class="rightCol">
Right Col Content
</div>
I want to calculate the height of the right col. and that height to Left col.
Upvotes: 0
Views: 101
Reputation: 2096
var leftHeight = $(".leftCol").height();
var rightHeight = $(".rightCol").height();
var diff = leftHeight - rightHeight;
More info here
Upvotes: 0
Reputation: 6953
I presume you want to set the left columns height the same as the right one! if so this would work.
$(".leftCol").height($(".rightCol").height());
Although you would only want to do this when the DOM is ready so it would be wise to only execute the code when the page is fully loaded or the column resizes.
$(function() {
$(".leftCol").height($(".rightCol").height());
});
HTH
Upvotes: 1