Hi again,

So, yes! The code works! Many thanks for the tips. :)

In your last example, I am just wondering about the $ (dollar sign)
before the "foo" variable. When should I use that on variables? I
assume that I would do this if I am going to use that variable to
reference an element... For example, is this correct usage/syntax:

...<snip>...

// Start closure:
$(function() {

var fooString = 'Just a string'; // <----- No dollar sign. Correct?
var $foo = $('#foo'); // Test ele, which use the $.
var $grfkldr = $('<img src="ajax-loader.gif">'); // Loader gif,
injected into DOM on document ready.
var $ldr = $('.loading'); // Loading container class.

$grfkldr.appendTo($ldr); // <----- Inject the loader gif. Is this
correct usage of the syntax?

$(window).load(function () {
// ... Do something with $foo
});

});

...</snip>...

Does it look like I have a good grasp on the syntax, based on my above
example?

Again, many thanks Erik and Klaus, I really really really appreciate
all of your help.

Have a great day/night!
Cheers,
Micky

On Dec 13, 11:57 pm, Klaus Hartl <[EMAIL PROTECTED]> wrote:
> On 14 Dez., 08:55, Klaus Hartl <[EMAIL PROTECTED]> wrote:
>
> > On 14 Dez., 04:47, "Erik Beeson" <[EMAIL PROTECTED]> wrote:
> > Try:
>
> > (function() {
> >   var $ele;
> >   $(document).ready(function() {
> >        $ele = $('#foo');
> >        $ele. // ... Do something with 'ele'...
> >   });
> >   $(window).load(function () {
> >        $ele. // ... Do something with 'ele'...
> >   });
>
> > })();
>
> Better try this:
>
> $(function() {
>   var $foo = $('#foo');
>   // ... Do something with $foo
>
>   $(window).load(function () {
>        // ... Do something with $foo
>   });
>
> });

Reply via email to