Here is the full code.
Click the "On" button, "Content" will move down and / or at the top of the tag content
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <button id="last">Scroll to bottom</button> <textarea Name="update" Id="update" cols="50" rows="25"></textarea> <script> $(document).ready(function() { $("#last").on("click", function() { var $textarea = $('#update'); $textarea.scrollTop($textarea[0].scrollHeight); }); }); </script> <button id="first">Move to Top</button> <script> $(document).ready(function() { $("#first").on("click", function() { var $textarea = $('#update'); $textarea.scrollTop(0); }); }); </script>
source share