I'm creating a basic widget for toggling elements visibility. To initialize, the function looks like this:
$('button').collapsable({
target:'#targetID'
});
I want to be able to pass a jquery function in, as example, this:
$('button').collapsable({
target:$(this).next();
});
Simple example, the point is I'd like to be able to pass in more complex functions as needed. The trouble I'm having is how to call that within the widget to call that function on its self.
Such as (code not remotely correct)
toggle:function(){
// i want it to firelike [this widget instances element].next();
this.call[this.options.target]
}
But I have no idea how to write that to work. Any thoughts are appreciated. Thanks in advance!