Chapter 12

Writing jQuery Plugins


  • Plugin Basics
  • Plugin Best Patterns and Practices
  • The jQuery UI Widget Factory

In this chapter, you learn how to write jQuery plugins. Being able to extend the power of jQuery with custom methods is a fundamental skill for a top jQuery developer.

A large part of the popularity of jQuery comes from the community-driven plugin ecosystem and the wide array of functionality available to expand on jQuery’s core functionality.

From subtle user-interface enhancements like those provided by hoverIntent to full-featured components like those available as part of the jQuery UI project, the plugin environment in jQuery is a vibrant, vital resource. It’s easy enough to take part and create plugins of your own. This chapter outlines how.

You learn about the different methods of extending jQuery, common plugin conventions, and advanced options and patterns to further expand your plugin possibilities.

After reading through this chapter, you’ll be ready to extend and enhance jQuery on your own, and will have a variety of resources available to help you in pretty much any plugin situation you’re likely to experience.


At the most basic level, creating a jQuery plugin is remarkably easy. After just the first page or two of this chapter, you should have enough knowledge to create a simple plugin.

Don’t be fooled by the ease of the basic level. “Easy” to do a basic version doesn’t mean it’s easy to do it right. Following ...

Get Professional jQuery now with O’Reilly online learning.

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