0
我有一個textarea,在輸入時會自動增長,如果更改了某個選項,則會有一些JS清除textarea。但是,當通過JS將值設置爲「」時,textarea不會縮回。關於如何讓這個工作的任何建議?將值設置爲「」後調整文本框的大小
function clearTextArea(){
\t document.getElementById('fldAdditionalInformation').value = "";
}
function auto_grow(element) {
element.style.height = "0px";
element.style.height = (element.scrollHeight+10)+"px";
}
<p>Change Value to clear Textbox:
<select onchange="clearTextArea();">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
</p>
<textarea style="width:100%;" id="fldAdditionalInformation" onkeyup="auto_grow(this)"></textarea>
完美,非常感謝你:) – LordTaz