ここでの考え方はjQuery
を$
としてinside関数に渡し、$
がjQueryであることを確認します。これは、$
を使用するコードを保護するために一般的に使用されます。特に、jQueryをmootoolsのような$
を使用する他のライブラリとともに使用する場合には、
たとえば、あなたがの<head>
<!--load jQuery-->
<script src="jquery.js"></script>
<script>
//"$" is jQuery
//"jQuery" is jQuery
</script>
<!--load another library-->
<script src="anotherlibrary.js"></script>
<script>
//"$" is the other library
//"jQuery" is jQuery
//out here, jQuery code that uses "$" breaks
(function($){
//"$" is jQuery
//"jQuery" is jQuery (from the outside scope)
//in here, jquery code that uses "$" is safe
}(jQuery));
</script>
可能二重にこのコードを持っていた場合は、[関数の引数としてjQueryのドル記号($)?](http://stackoverflow.com/questions/4983150/jquery-dollar-sign-as-function-argument) –