Reset textarea height in javascript

后端 未结 3 617
执笔经年
执笔经年 2021-01-14 07:13

I have a textarea (auto resizing) and I want to clear all of its contents including its height.

So far I\'ve tried:

document.getElementById(\'textare         


        
3条回答
  •  没有蜡笔的小新
    2021-01-14 07:45

    You could use setAttribute to reset style attribute added automatically during the resize :

    document.getElementById('reset').onclick = function(){
        var textarea = document.getElementById('target');
      
        textarea.setAttribute('style','');
        textarea.value = "";
    }
    
    

提交回复
热议问题