jQuery validate: number vs digits
14,854
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
Related videos on Youtube
Author by
Arsen K.
I am a freelancer and I love to build JavaScript interactive apps. Key technologies: HTML5, CSS3 JavaScript, AJAX, React, jQuery WordPress, PHP, MySQL
Updated on June 04, 2022Comments
-
Arsen K. almost 2 years
I wonder, what is the difference between
number
anddigits
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!
-
Karl Gjertsen about 8 yearsSo a digit is a whole number only? Will 3 be a digit and a number? 12.1 is a number, but not a digit?