[英]Cannot clear text input field
I've tried several different ways, including Pure-JS and jQuery, but I can't get my input text field to clear. 我尝试了几种不同的方法,包括Pure-JS和jQuery,但无法清除输入文本字段。 Please help. 请帮忙。
Here's the relevant HTML: 以下是相关的HTML:
<div align="center" id="searchDiv"></div>
<input type="text" id="searchBar" size="40" onsubmit="loadAllItems()">
<input type="submit" id="searchButton" value="Search" onclick="loadAllItems()">
<input type="button" value="Reset" onclick="reset()">
I'm trying to submit the searchBar, run backend code, and then call the reset() function to avoid manually clearing the text field: 我正在尝试提交searchBar,运行后端代码,然后调用reset()函数以避免手动清除文本字段:
function reset() {
document.getElementById("gradeQuestionsForm").reset();
document.getElementById('Output1').innerHTML = '';
document.getElementById('Output1').innerHTML = '';
updateStatus('Form has been reset.');
}
I tested with a JSFiddle . 我用JSFiddle进行了测试 。 Please advise. 请指教。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.