JM at Work
JM at Work

Reputation: 2437

Finding if a jquery plugin/function is available. Diff between $.pluginName() and $().pluginName()

I am trying to detect if a jQuery plugin is available, I tried

$.pluginName

but failed then tried

$().pluginName

it works. But whats the difference between the 2?

Upvotes: 0

Views: 682

Answers (2)

kobe
kobe

Reputation: 15835

You can look at this stackoverflow question only, they discussed a lot about this

How can I check if a jQuery plugin is loaded?

Upvotes: 3

mu is too short
mu is too short

Reputation: 434665

You should be looking at $.fn.pluginName. jQuery's $.fn is an alias for $.prototype and that's where all the plugin names go. The top-level $.* namespace is reserved for jQuery's utility functions such as $.each() and $.grep().

Upvotes: 3

Related Questions