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
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 = "";
}
<textarea id="target" rows="1" cols="10"></textarea>
<br>
<button id="reset">Reset</button>
Try resetting the style:
document.getElementById("textarea").style.height = "20px";
Just a JQuery version, that I'm using when I close a modal on my project
$("#jobURL").attr("style", "").val("")