📜  如何在 textarea 中应用滚动条 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:24.646000             🧑  作者: Mango

代码示例1
123456$('textarea').each(function () {  this.setAttribute('style', 'height:' + (this.scrollHeight) + 'px;overflow-y:hidden;');  }).on('input', function () {  this.style.height = 'auto';  this.style.height = (this.scrollHeight) + 'px';});  ×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX