title: Dynamically resize a div using jQuery
body: <p>I have a <code>div</code> (<code>id="mainDiv"</code>) which I need to dynamically resize if the user changes the size of their browser window. I have written the following code to try and get this to work however this doesn't seem to be setting the height of my <code>div</code>:</p>
  
  <pre><code>&lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      var height = $(window).height(); 
      $("#mainDiv").height(height);
  &lt;/script&gt;
  &lt;body&gt;
      &lt;div id="mainDiv"&gt;&lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>I don't know much jQuery, am I making an obvious mistake? </p>