Javascript - validation, numbers only

前端 未结 14 1689
感动是毒
感动是毒 2020-12-08 09:52

I\'m trying to get my login form to only validate if only numbers were inputted. I can it to work if the input is only digits, but when i type any characters after a number,

14条回答
  •  执笔经年
    2020-12-08 10:35

    here is how to validate the input to only accept numbers this will accept numbers like 123123123.41212313

    
    

    and this will not accept entering the dot (.), so it will only accept integers

    
    

    this way you will not permit the user to input anything but numbers

提交回复
热议问题