Check out a free preview of the full jQuery Plugins and jQuery UI course:
The "Widget Factory Methods" 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:

“Reading” options works, though extra code is necessary after initialization and is done by overriding the “_setOption” method. Private methods (ie: _prefix) can’t be called through the plugin wrapper. Public methods must not have the underscore to ensure availability. Example: Using “_trigger” to create a custom event, Scott passes randomly-generated hex colors used in the running example. Implement the “prevention” of a default behavior via custom events, by looking at a false return value from “_trigger”. Deal with events within a widget using “_bind” (Note: in 1.9 Final it’s called “_on”).

Get Unlimited Access Now