How do I add a method to an existing extended function in jQuery?
<p>How do I extend an existing object method in jQuery?</p>

<p>For instance, I'm using <a href="http://workshop.rs/jqbargraph/" rel="nofollow">jqBarGraph</a>. Now I want to add an <code>addGrid()</code> function to it. I was thinking I'd do it like so:</p>

<pre><code>(function($) {
  $.fn.jqBarGraph.addGrid = function(){
    var o = this;
    // do something with 'o'
    return o;
  }
})(jQuery);
</code></pre>

<p>...but when I call <code>$('#chart').jqBarGraph(options).addGrid();</code> -- I get the error:</p>

<p><strong><code>Uncaught TypeError: Cannot call method 'addGrid' of undefined</code></strong> </p>
