I want to restrict all characters entry except integer in to text box which I am using in angular 2 application , When user start typing other characters it should not show up in textbox ?
I tried out keyUp event , but doesn't seems to be working ?
<input type="text" id="txtEmpID" [(ngModel)]="filters.empID" class="form-control"
(keyup)="onKey($event)">
onKey(event: any) {
var charCode = event.keyCode;
if (charCode > 95 && charCode < 106 ) { {
console.log(charCode);
return false;
}
}
I cant use <input type="number" >
as application uses IE9 and older browser which doesn't support these new HTML 5 standards . I know IE sucks