Question: I'm currently coding a PHP and MYSQL chat. The chat messages are held in a div with the class '.chat'. It has a overflow:auto css element so it has a vertical scrollbar. I would like it so when you join the chat, it starts the scrollbar at the bottom.

I currently have the following code so far:

```
$(".chat").animate({ scrollTop: '7807897px' }, "fast");

```

This method doesn't always work, and can really become annoying. I know there must be an easier way out there, I'm just new to javascript and would really love some help :)

Thanks a lot

EDIT: My .chat div has a 80% height element. So the scroll by height doesn't seem to work for me

Answer: 
Why not get the height of `.chat` ?

```
$(".chat").animate({
    scrollTop: $('.chat').height() 
}, "fast");

```

If your scrolling the page you can use

```
$(document).height();

```
raplace:

```
$(".chat").animate({ scrollTop: '7807897px' }, "fast");

```

on:

```
$(".chat").animate({ scrollTop: $('.chat').height() }, "fast");

```