Pages

Tuesday, 28 May 2013

Scroll to down in textarea with jQuery and Javascript


Below is the sample code to scroll down to the textarea using jquery  and javascript :


Code to scroll to down in textarea with jQuery and javascript  :
//using jquery
 var textArea = $('#textarea');
 textArea.scrollTop( textArea[0].scrollHeight - textArea.height()   );

//using javascript
var textarea = document.getElementById('textarea');
textarea.scrollTop = textarea.scrollHeight;


Click to jsfiddle with the example.

Note*: this example is tested on Google Chrome.

If you found this post useful.Please comment and Share. Thanks :)

4 comments:

  1. its not working with multiline textbox

    ReplyDelete
  2. Code in the above box is working fine.

    There is mistake in JSFiddle. Please check this updated JSFiddle http://jsfiddle.net/AR7EH/52/


    ReplyDelete
  3. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog.
    Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from javascript and jquery training in chennai .
    or learn thru Javascript Training in Chennai.
    Nowadays JavaScript has tons of job opportunities on various vertical industry. javascript and jquery training in chennai

    ReplyDelete
  4. You blog is information. I have a blog. I write posts about programing coding

    ReplyDelete