Chapter 11. Creating Plugins

This chapter explains how to create your own plugins for jQuery. It starts with very basic recipes that can be used for small plugins. These simple recipes also demonstrate the basics of plugin development. In small steps, options, defaults, and methods are added.

When the plugin becomes too large, with superfluous copy and paste boilerplate code, the Plugin plugin is introduced. This generic plugin helps you to create your own plugins without copying boilerplate.

The second half of this chapter covers utility functions that help you to implement more advanced use cases inside your plugins. These utilities are called Callback and Deferred. jQuery uses these internally for functionality such as AJAX handling.

Recipe: ...

Get jQuery, jQuery UI, and jQuery Mobile: Recipes and Examples now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.