Calling JQuery function from different context
<p>This might be a very basic question but I'm trying to understand this behavior</p>

<p>This is my javascript code. I want to know why second call to foo does not work. Here is the <a href="http://jsfiddle.net/kwdxa/" rel="nofollow">JSFiddle link</a></p>

<pre><code>$.fn.foo = function(somestring){
  var $this = this;
  $this.html(somestring);
}

$(function(){
    $('#container').foo("within function"); //this works
});

$('#container').foo("outside"); //this does not
</code></pre>
