The QuickUI plugin $.control() is used to create and manipulate QuickUI controls via a regular jQuery instance.


Returns the element(s) cast to the class which was instantiated to create the elements. If the elements are an array of controls of differing classes, the result will be of their closest common ancestor class. If the elements are not controls, null is returned.

// Create a button. 
var $button = $( "#foo" ).control( BasicButton );
$button.content( "OK" );

// ... Later, we can retrieve the element and cast it to BasicButton instance.
var $button = $("#foo").control();
console.log( $button.content() );   // "OK"

$( element ).control( class, [ properties ] )

Creates a new instance of the indicated class around the element(s). Any existing element content will be passed to the control's content() property.

// Create instances of the MyControl class on some existing divs. 
$( "div" ).control( MyControl );

The above is equivalent to calling MyControl.createAt( $( "div" ) ).

If properties are supplied to the control() call, the indicated properties are set on the control during control creation. This occurs before the control's initialize() call is made.

// Create a button and set its content property in one step.
var $button = $( "#foo" ).control( BasicButton, { content: "OK" } );

$( element ).control({ properties })

Sets the indicated properties of the control at this element.

// Get an existing button and set some properties on it.
$( "#deleteButton" ).control({
    content: "Delete",
    disabled: true

The above is equivalent to:

// Get an existing button and set some properties on it.
$( "#deleteButton" ).control()
    .content( "Delete" )
    .disabled( true );