jQuery.isNumeric( value )

Description: 判断指定参数是否是一个数字值(字符串形式的数字也符合条件),返回 true 或者 false。

Example:

 $.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

JavaScript isNaN( value )

Description: 检查其参数是否是非数字值,返回 true 或者 false。

Example:

 isNaN(NaN);              // true
isNaN(undefined); // true
isNaN(null); // false 能转成0
isNaN(""); // false 能转成0
isNaN([]); // false 能转成0
isNaN({}); // true
isNaN(new Object()); // true
isNaN(new String()); // false
isNaN(new String("a")); // true
isNaN(new Array()); // false 能转成0
isNaN(new Date()); // false 能转成数字
isNaN(new Date().toString()); // true
isNaN(true); // false 能转成1
isNaN(0/0); // true

Notice:

  isNaN() 函数通常用于检测 parseFloat() 和 parseInt() 的结果,以判断它们表示的是否是合法的数字。

  isFinite() 函数用于检查其参数是否是无穷大。与 isNaN() 相反。

  

jQuery.isNumeric() 和 js isNaN()的更多相关文章

  1. 关于jQuery $.isNumeric vs. $.isNaN vs. isNaN

    在jQuery中,有几种方式可以判断一个对象是否是数字,或者可否转换为数字. 首先,jQuery.isNaN()在最新版本中已经被移除了(1.7之后),取而代之的是  jQuery.isNumeric ...

  2. jQuery $.isNumeric vs. $.isNaN vs. isNaN

    在jQuery中,有几种方式可以判断一个对象是否是数字,或者可否转换为数字. 首先,jQuery.isNaN()在最新版本中已经被移除了(1.7之后),取而代之的是  jQuery.isNumeric ...

  3. jquery.qrcode.min.js生成二维码 通过前端实现二维码生成

    主体代码: <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <tit ...

  4. jQuery与原生JS相互转化

    前端发展很快,现代浏览器原生 API 已经足够好用.我们并不需要为了操作 DOM.Event 等再学习一下 jQuery 的 API.同时由于 React.Angular.Vue 等框架的流行,直接操 ...

  5. jQuery工具--jQuery.isNumeric(value)和jQuery.trim(str)

    jQuery.isNumeric(value) 概述 确定它的参数是否是一个数字. $.isNumeric() 方法检查它的参数是否代表一个数值.如果是这样,它返回 true.否则,它返回false. ...

  6. jquery.i18n.properties.js hacking

    /****************************************************************************** * jquery.i18n.proper ...

  7. 【jQuery】 实用 js

    [jQuery] 实用 js 1. int 处理 parseInt(") // int 转换 isNaN(page) // 判断是否是int类型 2. string 处理 // C# str ...

  8. jquery.nicescroll.min.js滚动条插件的用法

    1.jquery.nicescroll.min.js源码 /* jquery.nicescroll 3.6.8 InuYaksa*2015 MIT http://nicescroll.areaaper ...

  9. JQuery plugin ---- simplePagination.js API

    CSS Themes "light-theme" "dark-theme" "compact-theme" How To Use Step ...

随机推荐

  1. Java Map 按Key排序和按Value排序

    Map排序的方式有很多种,这里记录下自己总结的两种比较常用的方式:按键排序(sort by key), 按值排序(sort by value). 1.按键排序 jdk内置的java.util包下的Tr ...

  2. Ubuntu下如何将普通用户提升到root权限

    在ubuntu的系统操作中,我们经常会使用到系统权限的,因为权限不足,导致在一些操作当中非常麻烦.要获取权限,最长使用的方法就是使用sudo指令,但是来回使用还是比较麻烦,有没有直接提升我们的用户权限 ...

  3. Android之ScrollView嵌套ListView冲突

    在ScrollView中嵌套使用ListView,ListView只会显示一行多一点.两者进行嵌套,即会发生冲突.由于ListView本身都继承于ScrollView,一旦在ScrollView中嵌套 ...

  4. C# GridControl 行背景颜色

    使用C# DevExpress_gridControl 行号行样式显示行背景颜色,必须取消自动变换行色属性 取消Focus变色,属性为OptionSelection--EnableAppearance ...

  5. Android ListView 自定义 Adapter

    自定义Adapter类 public class ListViewAdapter extends BaseAdapter { private static final String TAG = Mai ...

  6. python 环境问题

    1. 查看python安装的模块及版本 $pip freeze Babel== Flask== Flask-HTTPAuth== Flask-RESTful== Flask-SQLAlchemy==2 ...

  7. 关于 0xCCCCCCCC

    http://xingyunbaijunwei.blog.163.com/blog/static/76538067201281793111474/ http://stackoverflow.com/q ...

  8. mini install centOS log

    no ifconfig yum install net-tools ------------------------------------------------------------------ ...

  9. Java基础之集合框架——使用集合Vector<>挑选演员(TryVector)

    控制台程序. public class Person implements Comparable<Person> { // Constructor public Person(String ...

  10. Java 分布式应用