Create stateful jQuery plugins using the same abstraction as all jQuery UI widgets.
For more details on the Widget Factory, please see the API documentation (#).
## Default Functionality
This demo shows a simple custom widget created using the Widget Factory (jquery.ui.widget.js).
The three blocks are initialized in different ways. Click to change their background color. View the source and comments to understand how it works.
jQuery UI Widget Factory - Default Functionality .custom-colorize { font-size: 20px; position: relative; width: 75px; height: 75px; } .custom-colorize-changer { font-size: 10px; position: absolute; right: 0; bottom: 0; } $(function() { // Widget definition, where "custom" is the namespace and "colorize" is the widget name $.widget( "custom.colorize", { // Default options options: { red: 255, green: 0, blue: 0, // Callbacks change: null, random: null }, // Constructor _create: function() { this.element // Add a themed class .addClass( "custom-colorize" ) // Prevent double-click to select text .disableSelection(); this.changer = $( "