jQuery 判断是否为数字,是否是正整数

版权声明:欢迎转评,一起学习. https://blog.csdn.net/xiaobinqt/article/details/84206217

判断是否是数字可以使用 jQuery 函数 $.isNumeric()

判断是否是正整数可以使用正则表达式 /[1-9]+\d*/

参考

https://stackoverflow.com/questions/13219926/check-for-positive-integers-in-javascript-performance-and-security

https://stackoverflow.com/questions/14464213/jquery-check-if-value-is-numeric 

猜你喜欢

转载自blog.csdn.net/xiaobinqt/article/details/84206217