Pops wrote:
Whoa!  I thought I was beginning to understand this stuff, and
then.........

Ok, I thought that this piece of JS code in the <head> tag like so:

<html>
<head>

<script  type='text/javascript'>
(function($) {
   ... Does it see HTML tags? ...
})(jQuery);
</script>

</head>
<body>
.... html tags ..
</body>
</html>

That the whole purpose of (function($) {...... })(jQuery) was so it
ready to work as soon as the HTML tags are ready?

I have to move it the JS to the affter the tags.

<head>
</head>
<body>
.... html tags ..

<script  type='text/javascript'>
(function($) {
   ... Does it see HTML tags? ...
})(jQuery);
</script>

</body>


What am I missing here about jQuery?


You messed up a usual closure with jQuery document.ready method:

Use:

$(document).ready(function() {
    // DOM is ready
});

or the shortcut (which looks similiar to yours but isn't):

$(function() {
    // DOM is ready
});

And together with the self executing anonymous function you have:

(function($) {
    $(function() {
        // DOM is ready
    });
})(jQuery);


--Klaus

Reply via email to