1

This is div.

<div id='showmymessage' style="height:490px;overflow:auto;">

Hey nothing is working in my case. Div is set to overflow:auto.

I tried all these ways but scrollbar is not loading at bottom position.

  1. document.getElementById('showmymessage').scrollTop = 99999999999;

  2. var myDiv = document.getElementById('showmymessage'); myDiv.scrollTop = myDiv.scrollHeight;

  3. $('#showmymessage').scrollTop($('#showmymessage')[0].scrollHeight);

Please somebody tell if I made any mistake and try to help.

Raceimaztion
  • 9,494
  • 4
  • 26
  • 41
user3740116
  • 37
  • 1
  • 7
  • 2
    You tagged only PHP in your tags (it's adjusted), but you re posting JavaScript. There is a difference between that. As well, you 3rd option is a Jquery, did you include Jquery? Also please show us your code. With this whatyouposted now, we have no clue how we could solve your problem – Dorvalla Jul 10 '14 at 06:54
  • @Dorvalla: yes I included jquery.. And i tried all these methods by calling a function and putting this code in it. – user3740116 Jul 10 '14 at 07:07

1 Answers1

1

You want overflow:scroll instead of overflow:auto. Then your javascript should work.

Update

...then again, there's another question very similar where it works with overflow:auto.

Use jQuery to scroll to the bottom of a div with lots of text

It looks like it uses the same as your version 3. Working example:

http://jsbin.com/ucinu

Possibly something else wrong with your code? Check for missing closing tags, javascript errors etc?

Community
  • 1
  • 1
Dave B 84
  • 568
  • 1
  • 5
  • 14