I donβt know if I am saying this correctly, so Iβll just ask, explaining the example.
Say I wrote a jQuery plugin with onShowEdit .
Later I use my plugin and add a few other default functions / methods to it:
$('.editable_module:not(.custom)').editable({ onShowEdit: function(el){ initRequired(); $(':radio, :checkbox', el).prettyCheckboxes(); initDatePickers(); initChosen(); initMaskedInputs(); $('.dynamic_box.tabs').dynamicBoxTabs(); $('.trigger_dynamic_box').triggerDynamicBox('true'); } });
So now I have a basic / default element ( .editable_module ) that calls the plugin and contains some methods / functions that will be used in all instances.
My question arises when I need to add something to this for a one-time deal (I need to add some kind of behavior to this callback / event, but not to what is commonly used). Is it possible to extend or add to this callback / event without overwriting it? I mean, I know I can go and do this:
$('#new_selector').editable({ onShowEdit: function(el){ initRequired(); $(':radio, :checkbox', el).prettyCheckboxes(); initDatePickers(); initChosen(); initMaskedInputs(); $('.dynamic_box.tabs').dynamicBoxTabs(); $('.trigger_dynamic_box').triggerDynamicBox('true');
But is this really my only option?
Thanks in advance for any input / suggestions.
source share