Problem in Displaying Textarea

Hi everybody !

I’m newbie to rails. I have a problem to display the Textarea.

As I got some value from mysql database and load this value in a text
area.
By defualt the scroll bar for the text area is at the top like in
browsers. But I want the scroll bar of the text area at the bottom like
in yahoo & gmail chats ( I mean I want to see the last line of the
textarea at first. If want to see the first line, then I have to scroll
to the top.)

Is it possible. The code I used for the textarea as follows.

<% @message.each do |ms| %>

   <%= ms.content -%>

<%end%>

Where @message = Message.find(:all)

Thanks in advance.
Regards,
Veeraa.

Hi!
Just googled and found this on another discussion forum,
nameofyourtextarea.scrollTop = nameofyourtextarea.scrollHeight;
Hope this helps,

Thanks and regards,
Swanand

Swanand Deodhar wrote:

Hi!
Just googled and found this on another discussion forum,
nameofyourtextarea.scrollTop = nameofyourtextarea.scrollHeight;
Hope this helps,

Thanks and regards,
Swanand

Hi swanand!

Thanks for your great help. Thanks lot for getting this info by spending
your valueable time for me.

Thanks with regards,
Veeraa.

Veera S. wrote:

Swanand Deodhar wrote:

Hi!
Just googled and found this on another discussion forum,
nameofyourtextarea.scrollTop = nameofyourtextarea.scrollHeight;
Hope this helps,

Thanks and regards,
Swanand

Hi swanand!

Thanks for your great help. Thanks lot for getting this info by spending
your valueable time for me.

Thanks with regards,
Veeraa.

Hi swanand !

I used like this both as follows

and

<% language=“javascript”> ch1.scrollTop = ch1.scrollHeight; %>

in my .rhtml file . But doesn’t work. Any other suggestion.

Regards,
Veeraa…

Hi!
Can you please check if you are getting any JS error? Since according
to
Element: scrollTop property - Web APIs | MDN
http://developer.mozilla.org/en/docs/DOM:element.scrollHeight
the
current code should work
Thanks and regards,
Swanand.