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
Post a Comment