I am using this code to allow only digits to type in textbox but now I want to allow .
too. I modified this code but instead of allowing .
it allows hyphen -
.
function isNumberKeyDotAllowed(evt) {
var charCode = evt.which ? evt.which : evt.keyCode;
if (charCode == 46 || (48 <= charCode && charCode <= 57)) {
return true;
}
else {
return false;
}
}
button:
<asp:TextBox runat="server" ID="txtBoxAreaSqft" OnTextChanged="txtBoxAreaSqft_TextChanged"
PlaceHolder="Enter Digits Only" onkeypress="return isNumberKeyDotAllowed(event)" Enabled="true" AutoPostBack="true" CssClass="form-control"></asp:TextBox>