title: $.extend() with functions
body: <p>I'm writing a jQuery plugin that will need callback functions that are executed, for example, when an option is chosen from the <code>&lt;select&gt;</code> the plugin is applied to.</p>
  
  <p>I've seen plugins that allow you to define functions in the options you pass it, like this:</p>
  
  <pre><code>$('div.foo').pluginBar({ 
      option1: 'red',
      someEvent: function() {
          // Do stuff
      }
  });
  </code></pre>
  
  <p>I want to be able to define a default <code>someEvent</code> function in my plugin code, but if the user defines that function in the options they pass, it should overwrite the default function. Is this possible with <code>$.extend()</code>, or am I look in the wrong places?</p>
  
  <p>I've had a look at the <a href="http://docs.jquery.com/Plugins/Authoring" rel="nofollow noreferrer">plugin authoring</a> tutorial, but I don't think it covers extending the default behaviour of <em>functions</em> anywhere. I've read things about using an <code>init:</code> function, but I'd rather just be able to define a function (<em>inside</em> the plugin namespace) and change it with the options passed to the plugin.</p>