Check if function is defined on `jQuery` object -


we can check if function defined using

$.isfunction(myfunc) {     myfunc(); } 

but, want check if function defined on jquery/$ object. there way check this.

pseudo-code of i'm looking for:

if ($.hasfun(myfunc)) {     $('selector').myfunc(); } 

also, if i've jquery plugins on page, how can check if function exists on plugin?

you can check prototype object of jquery referred jquery.fn, so

if ($.isfunction($.fn.myfunc)) {     $('selector').myfunc(); } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - How can I echo out this array? -

javascript - IE11 incompatibility with jQuery's 'readonly'? -