Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery validate: number vs digits

I wonder, what is the difference between 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!

like image 884
Arsen K. Avatar asked May 24 '13 05:05

Arsen K.


1 Answers

Number rule will accept decimal numbers where as Digits won't accept decimals instead only digits.

Number

12.1 // true
-4   // true

Digits

12.1 // false
-4   // false

Check these samples :Digits

and Number

like image 167
Mahesh KP Avatar answered Nov 16 '22 15:11

Mahesh KP