I have ASP.Net TextBox. I want validation on its keypress that the Textbox should accept only numeric and the number should starts with 05.
In my javascript function it is accepting numeric only. What I will make changes in that function that the number should start only with 05 using Javascript.
<script type="text/javascript">
function isNumber(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return true;
}
</script>
<asp:TextBox ID="txtMobileNo" runat="server" onkeypress="return isNumber(event)" MaxLength="10" ></asp:TextBox>