总有人间一两风,填我十万八千梦

jQuery .isNumeric() 用法 手册 | 示例代码

jQuery开发手册 归档 251℃ 0评论

描述: 确定它的参数是否是一个数字。

  • 添加的版本: 1.7jQuery.isNumeric( value )

    • value
      类型: PlainObject
      用于测试的值。

$.isNumeric() 方法检查它的参数是否代表一个数值。如果是,它返回 true。否则,它返回false。该参数可以是任何类型。

例子:

以下是使用 $.isNumeric 检测各种输入类型的例子。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$.isNumeric("-10"); // true
$.isNumeric(16); // true
$.isNumeric(0xFF); // true
$.isNumeric("0xFF"); // true
$.isNumeric("8e5"); // true (exponential notation string)
$.isNumeric(3.1415); // true
$.isNumeric(+10); // true
$.isNumeric(0144); // true (octal integer literal)
$.isNumeric(""); // false
$.isNumeric({}); // false (empty object)
$.isNumeric(NaN); // false
$.isNumeric(null); // false
$.isNumeric(true); // false
$.isNumeric(Infinity); // false
$.isNumeric(undefined); // false

转载请注明:悠然品鉴 » jQuery .isNumeric() 用法 手册 | 示例代码

喜欢 (0)or分享 (0)
发表我的评论
取消评论

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
Open Popup

致:那些天天发邮件购买网站的RZ们

  • 我只是博客不更新了,不代表我域名上没有其他服务在运行,PS:服务器2027年到期。
    况且,你们自己心里很清楚你们买域名是干嘛的!不要在垃圾邮件OK?
    随便测试一下你们的 mail/domain 信息,笑死~~ 但凡有一个正经的,我都会回复一下。