The other solutions here don’t actually work for divs with lots of content — it “maxes out” scrolling down to the height of the div (instead of the height of the content of the div). So they’ll work, unless you have more than double the div’s height in content inside of it.
Here is the correct version:
$('#div1').scrollTop($('#div1')[0].scrollHeight);
or jQuery 1.6+ version:
var d = $('#div1'); d.scrollTop(d.prop("scrollHeight"));
Or animated:
$("#div1").animate({ scrollTop: $('#div1').prop("scrollHeight")}, 1000);
Related Posts:
- Automatically pausing html5 video as the ‘next’ button is pressed (javascript/ jquery)
- Adding attribute in jQuery
- Get the value in an input text box
- jQuery.addClass not working
- Get checkbox value in jQuery
- How to make a simple modal pop up form using jquery and html?
- Bootstrap throws Uncaught Error: Bootstrap’s JavaScript requires jQuery
- jQuery Scroll to Div
- jQuery checkbox event handling
- jquery – how to show a hidden div
- How to scroll to top of a div using jQuery?
- Check if a div exists with jquery
- Find out whether radio button is checked with JQuery?
- JQuery: ‘Uncaught TypeError: Illegal invocation’ at ajax request – several elements
- jquery ajax function not working
- jQuery find element by data attribute value
- Redirect from an HTML page
- What is ' and why does Google search replace it with apostrophe?
- Should I use tag for icons instead of ? [closed]
- What’s the difference between HTML ‘hidden’ and ‘aria-hidden’ attributes?
- How do I vertically center text with CSS?
- What does enctype=’multipart/form-data’ mean?
- Link with target=”_blank” and rel=”noopener noreferrer” still vulnerable?
- What does do?
- Check if checkbox is checked with jQuery
- Is there a minlength validation attribute in HTML5?
- Use images like checkboxes
- What is href=”#” and why is it used?
- Force a default browser on my android phone using a simple html shortcut page
- Is there a way to convert SWF to HTML5
- Should I use px or rem value units in my CSS?
- Flexbox: center horizontally and vertically
- HTML img scaling
- An invalid form control with name=” is not focusable
- How to call a PHP function on the click of a button
- Does bootstrap 4 have a built in horizontal divider?
- JavaScript function onhover in
- How can I set the image opacity for body background
- Section vs Article HTML5
- href=”tel:” and mobile numbers
- Align DIV’s to bottom or baseline
- Wrap text around bootstrap image
- CSS hover effect is not working on my code
- How do I style a dropdown with only CSS?
- vertical divider between two columns in bootstrap
- Why an inline “background-image” style doesn’t work in Chrome 10 and Internet Explorer 8?
- Set value to currency in
- Angular 2 Checkbox Two Way Data Binding
- How to center a navigation bar with CSS or HTML?
- center aligning a fixed position div
- HTML Entity Decode
- link with target=”_blank” does not open in new tab in Chrome
- My CSS won’t link to my HTML file
- Table fixed header and scrollable body
- css display table cell requires percentage width
- How do I make flex box work in safari?
- I’m getting favicon.ico error
- How do I refresh a DIV content?
- CSS Resize/Zoom-In effect on Image while keeping Dimensions
- How to make new page in html?
- How do I escape ampersands in XML so they are rendered as entities in HTML?
- How to draw a trapezium/trapezoid with css3?
- How to make music autoplay and loop in background
- jQuery sort elements using data id
- send mail to multiple receiver with HTML mailto [duplicate]
- Rails button_to vs. HTML Button Tag
- Stray end tag “head”
- How to create a text box in PHP to output data
- Auto refresh code in HTML using meta tags
- Multiple lines of input in
- Set textarea width to 100% in bootstrap modal
- javascript window.location in new tab
- How can I create a link to a local file on a locally-run web page?
- position fixed is not working
- Place a button right aligned
- td widths, not working?
- Accessing WordPress data via JSON gives HTML data for certain keys
- How to prevent pages from automatically adding line breaks?
- How to add a button that enables the user to insert a link in a textarea located in the front-end?
- Firefox CSS Animations Broke [closed]
- Unfamiliar HTML Properties in Avada and Divi Themes [closed]
- #text at the begging of every page, before the main content block
- How to keep HTML form field that is conditional hidden with javasript hidden after page reload?
- Phantom strong tags in wordpress
- Convert bookmarks.html file into WP posts
- With wp_list_category put every existing category into an option tag
- Https and Http for iFrame
- click event to unhide something after ajax not firing
- Excerpt keep stripping tags
- What file is the tag located in Genesis default theme?
- Lightbox type effect to support a HTML/jQuery image map
- Show preview of wordpress posts on external html sever
- Add other class content with reference class value
- Applying metatag to single page
- how add class in containers
- Add HTML between feed items
- Link opens a new website instead of my own
- ACF repeater image in video poster with jquery
- can’t make jQuery work (change image on time interval) [closed]
- Minify HTML on specific page