jQuery.fn.controls

  • function
jQuery.fn.controls  

Get the Controls associated with elements.

jQuery.fn.controls([type])

Parameters

  1. control {String | can.Control}Optional

    The type of Controls to find.

Returns

{can.Control}

The controls associated with the given elements.

When the widget is initialized, the plugin control creates an array of control instance(s) with the DOM element it was initialized on using can.data method.

The controls method allows you to get the control instance(s) for any element either by their type or pluginName.

 var MyBox = can.Control({
     pluginName : 'myBox'
 }, {});

 var MyClock = can.Control({
     pluginName : 'myClock'
 }, {});


//- Inits the widgets
$('.widgets:eq(0)').myBox();
$('.widgets:eq(1)').myClock();

$('.widgets').controls() //-> [ MyBox, MyClock ]
$('.widgets').controls('myBox') // -> [MyBox]
$('.widgets').controls(MyClock) // -> MyClock