Get div height after loading div content

I am trying to set the height of one div equal to another. I will call them left and right. The correct div content is not always the same and is loaded using jQuery. This is a filter, so every time you click on a filter, you change the content as well as the parent height of the div.

This is my code:

 jQuery(document).ready(function($) { $(window).resize(function() { location.reload(); }); var Height = $("#archive").outerHeight(); $('.recursos-sidebar').css("height", Height); }); 

The problem is that the left height of the div is equal to the right div when it is empty (the content does not load).

Does anyone know how I can get the height of the right div after changing the content every time?

+7
jquery height
source share
3 answers

You can get it from the clientHeight element:

 document.getElementById("test").clientHeight 
+2
source share

I don’t want to look for a source on your site, so there’s a crack in what I think you are talking about.

 <div id="firstdiv"></div> <div id="seconddiv"></div> <script> $("firstdiv").change(function () { var s= $("seconddiv").height(); $(this).height(sndHeight); }); </script> 
0
source share

Here is your answer:

 $( document ).ready(function() { $("#firstDiv").css('height',$("#secondDiv").height()); }); 

And the demo you will find here: http://fiddle.jshell.net/stryd3r/MgnT8/

0
source share

All Articles