Q:

Resize element when another element is resized

I am using jQuery to resize an element when the window is resized using:
$(window).resize(function() {
  topHeight = $("#top").height();
  height = $(window).height() - 210;
  $("#container").height(height);
  $("#g").height(height-25);
});

With the topHeight getting the most recent height of the top bar since it can rearrange.
My problem is that I can't figure out a way to resize the #container when the #top changes height. I've tried using $("#topRow").resize(function() { }), but it seems as though that doesn't work with elements.

A:

You have to catch every event when #top's height changes.
If it happens when you resize the window, then you should bind your logic to window.resize, so your code in the question should work.
If there are other events when #top changes its height, then you should bind the logic there too.
Update: in the comments you mentioned that there is a multiple selection field, which can make the #topRow element change its height, so that is an event, which you can add your logic to.
Note: there is another option. You create a setInterval which periodically checks the size of #topRow and resises the #container if necessary, but I personally don't recommend this solution.

