I'm currently working on an Angular project where I can have an input field whose type is number. I want to allow only numbers, not other special characters.
If I run my project on mobile, I can't enter a dot character at the first position. But I can enter a dot character as second. See my attached image.
I used this example to avoid special characters inside textbox while typing. Their example is working fine. But on my mobile the dot characters will get placed on the second and third position while typing.
Gow to solve this? I hope someone can help me.
<input type="number" id=txtqty{{i}} pattern="[0-9]*" inputmode="numeric" min="1" max={{data.quan_limit}} [(ngModel)]="data.quantity" (keyup)="quantityModelChange($event,data)" class="Col-tdinput" oninput="$(this).val($(this).val().replace(/[^0-9]/g, ''))">