【发布时间】:2014-10-31 00:39:36
【问题描述】:
我想在单击按钮 (html) 时清除 asp 文本框。
所以基本上JS函数是:
<script type="text/javascript">
function clearTextBox() {
document.getElementByID('<%=txtFName.ClientID%>').value = "";
}
</script>
还有一个 asp.net 文本框
<asp:TextBox ID="txtFName" runat="server" class="form-control" placeholder="First name" AutoCompleteType="Disabled" MaxLength="30" />
还有一个 HTML 按钮
<span class="input-group-btn">
<button class="btn default" id="clearButton" type="button" onclick="clearTextBox()"><i class="fa fa-times"></i></button>
</span>
所有按钮和其他控件都在一个asp更新面板中(不知道是否有所不同)
当我单击 HTML clearButton 时没有任何反应,Web 控制台上出现错误:
Uncaught TypeError: undefined is not a function
clearTextBox
onclick
【问题讨论】:
标签: javascript c# jquery html asp.net