I don't understand benefit of anonymous function (or self-invoke)
(function () {
$('#panel').css('background', 'red'); // I will invoke myself
})();
because if you want to manipulate DOM you should do it after page load finish that you should use $document.ready()
intead of anonymous function.
(because manipulate DOM require wait until that page ready)
and if you want to do something instantly after load specifical element, you could write script tag after that element like this
<body>
<div>foo</div>
<div id="panel">bar</div>
<script>
$('#panel').css('background', 'red');
</script>
<div>some content</div>
</body>
so what is anonymous function benefit? please tell me thanks.