看下面的代码,点击【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/
数据分析师2017-10-01 01:15:17
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.