May 2017
Intermediate to advanced
448 pages
10h 10m
English
When we write jQuery plugins, we must assume that the jQuery library is loaded. We cannot assume, however, that the dollar ($) alias is available. Recall from Chapter 3, Handling Events, that the $.noConflict() method can relinquish control of this shortcut. To account for this, our plugins should always call jQuery methods using the full jQuery name or internally define $ themselves.
Especially in larger plugins, many developers find that the lack of the dollar ($) shortcut makes code more difficult to read. To combat this, the shortcut can be locally defined for the scope of the plugin by defining a function and immediately invoking it. This syntax for defining and invoking a function at once, often ...
Read now
Unlock full access