How to have a textarea to keep scrolled to the bottom when updated

前端 未结 5 1928
礼貌的吻别
礼貌的吻别 2020-12-03 03:06

My problem is a bit off the cuff here, so I\'ll try to explain this best I can.

I have a text area, having css of #object{overflow:hidden;resize:none;}.

5条回答
  •  甜味超标
    2020-12-03 03:41

    You can do it by javascript. Set the scrollTop property of text area with scrollHeight property like below:

    document.getElementById("textarea").scrollTop = document.getElementById("textarea").scrollHeight 

提交回复
热议问题