title: Why do I get "Uncaught TypeError: Cannot read property" error with this variable?
body: <p>In <a href="http://jsfiddle.net/WyMsF/" rel="nofollow">this jsFiddle</a> I have two variables that would be either undefined or null. The script works if the first variable is initialised, but not if the second is used. You can test this by commenting out each one and running the script.</p>
  
  <p>This is the code:</p>
  
  <pre><code>var test = $('.not-here').height(); // works with this variable
  var test2 = $('.also-not-here').offset().top; // doesn't work with this
  
  $('#output').append('yeah');
  </code></pre>
  
  <p>Why do I have this problem and how do I get around it?</p>