In jQuery, what does $.fn. mean?

后端 未结 3 1803
慢半拍i
慢半拍i 2020-12-07 12:11

In jQuery, what does $.fn. mean? I looked this up on google but couldn\'t find any concrete examples.

$.fn.something = function{}
相关标签:
3条回答
  • 2020-12-07 12:31

    See Plugins/Authoring

    0 讨论(0)
  • 2020-12-07 12:48

    It allows you to extend jQuery with your own functions.

    For example,

    $.fn.something = function{}
    

    will allow you to use

    $("#element").something()
    

    $.fn is also synonymous with jQuery.fn which might make your Google searches easier.

    See jQuery Plugins/Authoring

    0 讨论(0)
  • 2020-12-07 12:55

    This has been covered in some detail here:

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

    But the short of it is that $.fn is an alias for $jQuery.prototype

    0 讨论(0)
提交回复
热议问题