O'Reilly logo

Instant jQuery Boilerplate for Plugins by Jonathan Fielding

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting started with your first plugin (Simple)

Having already set up a template for creating jQuery Plugins using jQuery Boilerplate, we are now able to progress to writing our first plugin. For this recipe, we will look at how we can create a plugin that manipulates the shape of a div element.

We will achieve this by writing some HTML to declare a shape and a button, declaring each shape in the CSS, and then using the JavaScript to toggle which shape is shown by toggling the CSS class appended to it. Writing this plugin should help you familiarize yourself both with jQuery plugin development and the jQuery Boilerplate template.

Getting ready

Before we dive into our development, we need to have a good idea of how our plugin is going to work. For ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required