Roy Genergon Roy Genergon - 3 months ago 17
HTML Question

Scroll to down in textarea with jQuery

<h2>Greetings</h2>
<div class="container">
<div class="inner">
Hello
<p>Test</p>
</div>
<textarea id="one" class="inner">
Goodbye
</textarea>
</div>

$("#one").append("your text to append");
$("#one").append("your text to append");
$("#one").append("your text to append");
$("#one").append("your text to append");


LIVE: http://jsfiddle.net/tGFmq/

how can i make automatically scroll to down in this textarea?

Answer

Add this bit to your code (preferably at the end of whatever inserts you have):

    var psconsole = $('#one');
    if(psconsole.length)
       psconsole.scrollTop(psconsole[0].scrollHeight - psconsole.height());