0

Having an input field where the user will enter the amount in it. i do want to restrict the users from entering decimal points. Eg : if user tries to enter 121.2 , i should not allow him to place '.'(decimal point) character in the input box.

The below sample works on web but the same is not working on android mobile numberic keypad.

Sample-1

<input (keydown)="if(event.key==='.'){event.preventDefault();}" type="number">

Sample-2 : (Have tried this to solve issue in numeric keypad but doesnt work)

<input (keydown)="if(event.key=='.' || event.keyCode == 229 ||event.key===null ||event.key=='Unindentified'){event.preventDefaul();}" type="number">

Any help?

Jagadeesh
  • 1,967
  • 8
  • 24
  • 47

0 Answers0