Use jQuery to scroll to the bottom of a div with lots of text
<p>I have a div with a scrollbar on the right when there is a lot of text in it. I tried to use this code to scroll to the bottom of a div when the page loads, but I am not having much luck. How can it be achieved?</p>

<p>Style:</p>

<pre><code>div.messageScrollArea{width:100%; max-height:300px; overflow:auto;}
</code></pre>

<p>JavaScript code:</p>

<pre><code>$(document).ready(function () {
    var objDiv = $('.messageScrollArea);
    if (objDiv.length &gt; 0)
        objDiv[0].scrollTop = objDiv[0].scrollHeight;
});
</code></pre>
