Reputation: 37
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.
document.getElementById('showmymessage').scrollTop = 99999999999;
var myDiv = document.getElementById('showmymessage');
myDiv.scrollTop = myDiv.scrollHeight;
$('#showmymessage').scrollTop($('#showmymessage')[0].scrollHeight);
Please somebody tell if I made any mistake and try to help.
Upvotes: 1
Views: 5688
Reputation: 618
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:
Possibly something else wrong with your code? Check for missing closing tags, javascript errors etc?
Upvotes: 1