I'd like to understand the jQuery plugin syntax

前端 未结 7 1045
遇见更好的自我
遇见更好的自我 2020-11-28 18:39

The jQuery site lists the basic plugin syntax for jQuery as this:

(function( $ ){    
  $.fn.myPlugin = function() {      
    // there\'s no need to do $(th         


        
7条回答
  •  生来不讨喜
    2020-11-28 19:09

    To find a clear explanation of this and other modern javascript tricks and common practices, I recommend reading Javascript Garden.

    http://bonsaiden.github.com/JavaScript-Garden/

    It's especially useful, because many of these patterns are widely used in many libraries but not really explained.

提交回复
热议问题