これは非常に基本的な質問かもしれませんが、私はこの動作を理解しようとしています
これは私のJavaScriptコードです。fooへの2回目の呼び出しが機能しない理由を知りたいです。これがJSFiddleリンクです
$.fn.foo = function(somestring){
var $this = this;
$this.html(somestring);
}
$(function(){
$('#container').foo("within function"); //this works
});
$('#container').foo("outside"); //this does not