jQuery isFunction check error “function is not defined”

By putting () after the function name, you’re actually trying to run it right there in your first line.

Instead, you should just use the function name without running it:

if ($.isFunction(myfunc)) {

However – If myfunc is not a function and is not any other defined variable, this will still return an error, although a different one. Something like myfunc is not defined.

You should check that the name exists, and then check that it’s a function, like this:

if (typeof myfunc !== 'undefined' && $.isFunction(myfunc)) {

Working example here: http://jsfiddle.net/sXV6w/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)