【发布时间】:2010-06-22 04:13:55
【问题描述】:
在 jQuery 中,$.fn 是做什么的。意思是?我在谷歌上查了这个,但找不到任何具体的例子。
$.fn.something = function{}
【问题讨论】:
标签: jquery jquery-plugins
在 jQuery 中,$.fn 是做什么的。意思是?我在谷歌上查了这个,但找不到任何具体的例子。
$.fn.something = function{}
【问题讨论】:
标签: jquery jquery-plugins
它允许您使用自己的函数扩展 jQuery。
例如,
$.fn.something = function{}
将允许您使用
$("#element").something()
$.fn 也是 jQuery.fn 的同义词,这可能会使您的 Google 搜索更轻松。
【讨论】:
这里已经详细介绍了这一点:
Why jQuery do this: jQuery.fn.init.prototype = jQuery.fn?
但简而言之,$.fn 是 $jQuery.prototype 的别名
【讨论】:
【讨论】: