검색결과 리스트
글
욜심히 만들었더니 jQuery.type() 이란 메소드가 있다. ㅡㅡ; 찾아볼걸...
// getType(true) "boolean"를 리턴
// getType(1) "number"를 리턴
// getType(1.1) "number"를 리턴
// getType("") "string"를 리턴
// getType(function(){}) "function"를 리턴
// getType(new Date()) "date"를 리턴
// getType(/^$/) "regexp"를 리턴
function getType(obj) {
var msg = "undefined"
,myObj = obj
;
if ( myObj != null ) {
var strType = Object.prototype.toString.call(myObj);
var match = strType.match(/^\[object (.+)\]$/i);
msg = match && match[1].toLowerCase();
}
return msg;
}
'JavaScript > jQuery' 카테고리의 다른 글
[jQuery] ajaxForm 구현 (0) | 2012.07.23 |
---|---|
[jQuery] Plugin Validation (0) | 2012.06.18 |
[jQuery] jQuery API 검색 사이트 jqapi.com, visualjquery.com (0) | 2012.02.07 |
[jQuery] jQuery Number formatter plugin (0) | 2012.01.30 |
[jQuery] $.ajax json type으로 보내기 (0) | 2011.12.19 |
RECENT COMMENT