【问题标题】:In jQuery, what does $.fn. mean?在 jQuery 中,$.fn 是做什么的。意思是?
【发布时间】:2010-06-22 04:13:55
【问题描述】:

在 jQuery 中,$.fn 是做什么的。意思是?我在谷歌上查了这个,但找不到任何具体的例子。

$.fn.something = function{}

【问题讨论】:

    标签: jquery jquery-plugins


    【解决方案1】:

    它允许您使用自己的函数扩展 jQuery。

    例如,

    $.fn.something = function{}
    

    将允许您使用

    $("#element").something()
    

    $.fn 也是 jQuery.fn 的同义词,这可能会使您的 Google 搜索更轻松。

    jQuery Plugins/Authoring

    【讨论】:

      【解决方案2】:

      这里已经详细介绍了这一点:

      Why jQuery do this: jQuery.fn.init.prototype = jQuery.fn?

      但简而言之,$.fn$jQuery.prototype 的别名

      【讨论】:

        【解决方案3】:

        【讨论】:

        • +1 哇,突然出现了四个类似的答案。删除我的并支持最接近它的那个。
        • 嘿,我比他快 27 秒 ;)
        猜你喜欢
        • 2018-06-09
        • 2011-12-27
        • 2017-09-12
        • 2013-10-31
        • 1970-01-01
        • 1970-01-01
        • 2015-07-09
        • 2011-11-21
        • 2011-08-12
        相关资源
        最近更新 更多