jQuery的$ .fn.myFunction列出但在检查$ .isFunction时未定义

时间:2016-03-17 13:01:38

标签: javascript jquery function

jQuery的$ .fn显示myFunction在我执行时被列为函数

console.log($.fn)

然而,当我这样做时:

console.log($.fn.myFunction) 

它返回undefined

我有以下代码用于调试目的:

console.log($.fn);
//returns a list of functions with myFunction correctly listed as one
console.log($.fn.myFunction);
//returns undefined
console.log($.fn.contextmenu);
//correctly returns the function (I believe this is a generic jQuery function)
console.log($.fn.myFunction);
//returns undefined
console.log($.isFunction($.fn.myFunction));
//returns false
console.log($.isFunction($.myFunction));
//returns false

0 个答案:

没有答案