2014. 2. 13. 15:42 IT/jquery_javascript
jquery 숫자 여부 체크 isNumeric
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
개요 : 인자가 숫자인지 판별합니다.
- jQuery.isNumeric( value )
- value 숫자인지 확인할 인자
$.isNumeric()
함수는 인자가 숫자 값인지 확인합니다. 숫자라면 true
. 아니라면 false
를 반환합니다. 인자는 뭐든지 사용가능합니다. 16진수도 체크 가능하네요.
예 제
다양한 값들을 체크해 봅니다.
$.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
'IT > jquery_javascript' 카테고리의 다른 글
javascript에서 숫자를 문자로 ... 문자를 숫자로 변경 (0) | 2014.05.14 |
---|---|
jQuery Radio (0) | 2014.03.11 |
jquery each callback function (0) | 2014.02.13 |
jQuery Select Box (0) | 2014.02.10 |
‘제다이급’ 자바스크립트 고수들이 전하는 6가지 개발팁 (0) | 2013.11.28 |