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

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -