This course is out of date and does not reflect our standards or industry best practices. We now recommend you take the Complete Intro to Web Development, v3 course.

Check out a free preview of the full jQuery Plugins and jQuery UI course:
The "Plugin Tips" Lesson is part of the full, jQuery Plugins and jQuery UI course featured in this preview video. Here's what you'd learn in this lesson:

Creating a useful plugin requires accepting parameters that set how your plugin will function on a wider scale. Add parameters to your function using the example of creating a plugin to pass RBG values to set the color. There can be a problem with this implementation since it is actually calculating the HEX color for every element it affects – terribly inefficient. Note: You can improve performance by putting the calculation before you iterate. Option hashes can be used instead of ordered parameters, as demonstrated when applied to the RGB example. It’s a good idea to set a default for when parameters are not specified. To help ensure “clean” code, define your defaults up front. You may choose to expose your defaults so that users can define their own across-the-board. Manipulating the defaults of the individual plugin allows the user to easily update App defaults with their own choices.

Get Unlimited Access Now