I am trying to build a DateTimePicker Widget and do not want to worry about the instantiation of the widget so I have created a Can.Control which takes the html body as the element.
But, now my input elements are rendered in the DOM using can.view. How do I bind an event to the insertion of a new dateTime element to my control scope?
/**
* DateTime Plugin
*/
plugins.DateTime = can.Control.extend({
},{
init : function ( element , options ){
},
'input.dateTime click' : function (){
$( this.element ).find('input.dateTime').datetimepicker();
}
});
$(function(){
new plugins.DateTime('body');
});
Is there any way I can specify 'input.dateTime load' to bind a datepicker when the element is added to the control element?