开发者

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

开发者 https://www.devze.com 2023-03-07 13:10 出处:网络
I am trying to detect if a jQuery plugin is available, I tried $.pluginName but failed 开发者_开发知识库then tried

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?


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().


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

How can I check if a jQuery plugin is loaded?

0

精彩评论

暂无评论...
验证码 换一张
取 消