I want to clear an asp textbox when click to a button (html).
so basically the JS function is:
<script type="text/javascript">
function clearTextBox() {
document.getElementByID('<%=txtFName.ClientID%>').value = "";
}
</script>
an asp.net TextBox & a HTML button
<asp:TextBox ID="txtFName" runat="server" class="form-control" placeholder="First name" AutoCompleteType="Disabled" MaxLength="30" />
<span class="input-group-btn">
<button class="btn default" id="clearButton" type="button" onclick="clearTextBox()"><i class="fa fa-times"></i></button>
</span>
All buttons and other controls are in an asp update-panel (don't know if it makes different)
Nothing happend when I clicked to the HTML clearButton, error on the web console:
Uncaught TypeError: undefined is not a function
clearTextBox
onclick
Any solution to make it work (using
JQuery is fine), i dont know much about JS.