Last active
August 29, 2015 14:07
-
-
Save wonderbeyond/4026ff458e2430f7fc27 to your computer and use it in GitHub Desktop.
arale/validator addRule for integer check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MyValidator.addRule('integer', function(options){ | |
| var v = Number(options.element.val()); | |
| if(v && Math.floor(v) === v){ | |
| return true; | |
| } | |
| return false; | |
| }, '{{display}}必须为整数'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment