<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");
如何让文本区域自动向下滚动?
最佳答案
将此位添加到您的代码中(最好在您插入的任何内容的末尾):
var psconsole = $('#one');
if(psconsole.length)
psconsole.scrollTop(psconsole[0].scrollHeight - psconsole.height());
关于javascript - 使用 jQuery 在 textarea 中向下滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8467368/