Microsoft JScript runtime error: '0.scrollHeight' is null or not an object
<p>I use jQuery to scroll the div vertical bar to it's last line in my web chat application. I found that whenever there are several lines which don't need to scroll down to the last line, it comes out an error says: Microsoft JScript runtime error: '0.scrollHeight' is null or not an object. When there are more lines, it doesn't show. Anyone knows how to resolve this? 
my code:</p>

<pre><code>var height = $('#chatbox')[0].scrollHeight;
$('#chatbox').scrollTop(height);
</code></pre>

<p>chatbox is the div id. I set overflow-y: auto; for chatbox</p>
