Chapter 6. Function plugins

This chapter covers

  • Defining a function plugin
  • Localizing content via a function plugin
  • Accessing cookies via a function plugin

The collection plugins from the previous chapter worked by operating on a set of elements retrieved from the page via a selection and/or traversal process, but you can also create plugins that don’t apply to such collections but provide utility functions within the jQuery framework. These are function plugins.

Examples of this type of plugin include the Debug plugin (http://jquery.glyphix.com/), which provides logging output for debugging purposes, and the Cookie plugin, which provides interactions with the cookies for a website (covered in detail in section 6.2). As with the earlier ...

Get Extending jQuery now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.