javascript - 插入文本到textarea后,自动显示插入的最后一行
PHPz
PHPz 2017-04-10 12:42:33
0
2
621

看下面的代码,点击【add content】后会在textarea最后一行插入内容,我希望内容超过显示区域后,textarea 自动滚动到最后一行显示。需要加神马呢?

<h2>SAMPLE</h2>
<a href="###" id="add">add content</a>
<br/><br/>

<textarea id="text">
Goodbye
</textarea>
$('#add').click(function() {
    $("#text").append("the text to append \n");
});

http://jsfiddle.net/Sn5Cz/

PHPz
PHPz

学习是最好的投资!

reply all(2)
数据分析师

javascript - After inserting text into textarea, automatically display the last inserted line - PHP Chinese website Q&A - javascript - After inserting text into textarea, automatically display the inserted last line - PHP Chinese website Q&A

Take a look around Oh, study it.

刘奇

http://stackoverflow.com/questions/84...

http://jsfiddle.net/Sn5Cz/1/

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template