jQuery.isNumeric()方法

jQuery 教程 · 2019-03-28 21:56:35

实例

判断输入值类型

$(function () { function fun( html ){ document.body.innerHTML += "<br>" + html; } // true fun($.isNumeric( "-10" )); fun($.isNumeric( "0" )); fun($.isNumeric( 0xFF )); fun($.isNumeric( "0xFF" )); fun($.isNumeric( "8e5" )); fun($.isNumeric( "3.1415" )); fun($.isNumeric( +10 )); fun($.isNumeric( 0144 )); //false fun($.isNumeric( "-0x42" )); fun($.isNumeric( "7.2acdgs" )); fun($.isNumeric( "" )); fun($.isNumeric( {} )); fun($.isNumeric( NaN )); fun($.isNumeric( null )); fun($.isNumeric( true )); fun($.isNumeric( Infinity )); fun($.isNumeric( undefined )); })

定义和用法

$.isNumeric() 函数用于判断指定参数是否是一个数字值。

注意:在jQuery 3.0中,$.isNumeric()方法只有接收number类型的参数,或者是可以被强制为有限数值的 string类型的参数时,才会返回true,否则返回false。

语法

$.isNumeric( value )

参数 描述
value 任意类型 需要进行判断的任意值。

点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html

查看所有标签

移动社交时代的互动搜索营销(全彩)

移动社交时代的互动搜索营销(全彩)

萧秋水、秋叶、南方锈才 / 电子工业出版社 / 2014-8-1 / 55.00元

《移动社交时代的互动搜索营销(全彩)》跳出搜索引擎的局限,告诉读者如何利用互联网找到客户的思维。《移动社交时代的互动搜索营销(全彩)》只谈如何有效利用搜索引擎(包括移动端搜索)、电商网站、新媒体,不传播所谓的一夜暴红、一夜暴富的神话。《移动社交时代的互动搜索营销(全彩)》作者利用其丰富的实战经验,结合大量国内不同行业的实际应用案例,生动地告诉读者,怎样正确地利用搜索引擎,以很小的投资获得巨大的回报......一起来看看 《移动社交时代的互动搜索营销(全彩)》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

SHA 加密
SHA 加密

SHA 加密工具

html转js在线工具
html转js在线工具

html转js在线工具