asp.net textbox with java script problem
- by Eyla
I'm trying to check if asp.net textbox is empty or not using java script.
my code working ok but if
I enter only numbers will conder it empty so I have either enter letters and numbers or only letters.
Please advice.
here is my code
<script type="text/javascript">
function check(){
var txt = document.getElementById('<%=txt.ClientID%>').value;
//(isNaN(cmbStateHome) == false
if (isNaN(txt) == false) {
alert("Please enter some thing.");
}
else {alert("ok");}
}
}
</script>
<asp:TextBox ID="txt" runat="server"></asp:TextBox>
<asp:TextBox ID="txtZipCodeHome" runat="server" Style="top: 361px; left: 88px; position: absolute;
<asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="check()">LinkButton</asp:LinkButton>