If you are trying on angular this might help
To get the input as number (with a decimal point) then
<input [(ngModel)]="data" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');">
Now this will not update the value in model correctly to explicitly change the value of model too add this
<input [(ngModel)]="data" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');" (change)="data = $event.target.value">
The change event will fire after the value in the model has been updated so it can be used with reactive forms as well.