设置 textarea 默认滑动到底部

javascript:

var textarea = document.getElementById('textarea_id');
textarea.scrollTop = textarea.scrollHeight;

 jQuery:

$(document).ready(function(){
    $('#textarea_id').scrollTop($('#textarea_id')[0].scrollHeight);
});

原问题 stackoverflow

其他 textarea 相关

  readonly 属性:  <textarea readonly>All things are easy that are done willingly.</textarea>

  textarea 换行符: var newMess = oldMess + "\r\n" + addedMess ;

原问题 开源中国

 

posted @ 2015-12-15 10:24  提佰萬  阅读(1074)  评论(0编辑  收藏  举报