JQuery validate: number versus numbers

I wonder what is the difference between the number and digits methods? I have been working with this plugin for a long time, and both of these methods seem to return the same result ...

Thanks in advance!

+6
source share
1 answer

The number rule will accept decimal numbers, in which numbers will not accept decimal places instead of numbers.

room

 12.1 // true -4 // true 

Digits

 12.1 // false -4 // false 

Check out these samples: Digits

and Number

+17
source

Source: https://habr.com/ru/post/945749/


All Articles