这是我正在尝试的代码:标记:
<textarea class="form-control textareaInput" rows="12" id="textareaInput"></textarea>
<div class="row">
<div class="col-lg-2 text-center">
<div class="form-group">
<button class="form-control btn btn-primary reset" onclick="myFunction()">Reset</button>
</div>
</div>
</div>
我的功能:
function myFunction() {
//alert("ok");
document.getElementById("textareaInput").reset();
}
单击 reset
按钮时出现错误。
错误:
未捕获的类型错误:document.getElementById(…).reset 不是函数
问题出在哪里?注意:我没有使用 form
标签。
原文由 Chonchol Mahmud 发布,翻译遵循 CC BY-SA 4.0 许可协议
你应该使用