I have the following code which is running properly, but when we use numeric keypad (located right side on keyboard) it’s not typing anything.
Please help
<asp:TextBox ID="txtCNICNo" runat="server" maxlength="15" data-inputmask="'mask': '99999-9999999-9'" autocomplete="off">
<script>
$('#txtCNICNo').keydown(function () {
//allow backspace, tab, ctrl+A, escape, carriage return
if (event.keyCode == 8 || event.keyCode == 9
|| event.keyCode == 27 || event.keyCode == 13
|| (event.keyCode == 65 && event.ctrlKey === true))
return;
if ((event.keyCode < 48 || event.keyCode > 57))
event.preventDefault();
var length = $(this).val().length;
if (length == 5 || length == 13)
$(this).val($(this).val() + '-');
});
</script>