Hello,
I'm writing a jQuery plugin that has a couple of callbacks, and am at the point where I need to allow one of the callbacks to run. The callback in question is 'beforeListItemSelect', so naturally I'd like the plugin code after the callback to not run if the callback function returns false. So the following is a section of my plugin code:
$listItems.live('click', function() {
$.isFunction(options.beforeListItemSelect) && options.beforeListItemSelect.call(this);
// perform select action (apply css, etc)
$.isFunction(options.afterListItemSelect) && options.afterListItemSelect.call(this);
});
So if I'm calling the plugin (myPlugin), and I've defined the beforeListItemSelect callback like this:
$('#someDiv').myPlugin({
beforeListItemSelect: function() {
return false;
}
});
I would want the plugin to terminate after the beforeListItemSelect callback. Does anyone have an idea of how I can set up the plugin to not proceed if false is returned from the callback?
Thanks very much.