[jQuery] Re: Shared variables, events, and namespaces...

2007-12-17 Thread Micky Hulse
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

[jQuery] Re: Shared variables, events, and namespaces...

2007-12-17 Thread Joseph Morris
I am out of the office today, Monday 12/16/2007. I will be back in the office Tuesday 12/17/2007. If you need to reach me due to an emergency, please call my mobile at 770.367.8401. Thanks, Joe

[jQuery] Re: Shared variables, events, and namespaces...

2007-12-17 Thread Klaus Hartl
On 17 Dez., 08:31, Micky Hulse [EMAIL PROTECTED] wrote: 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

[jQuery] Re: Shared variables, events, and namespaces...

2007-12-17 Thread Micky Hulse
Hi Klaus! Thanks for the quick reply and excellent explanation. :) That makes a lot of sense to me now. I will be sure to follow that practice from now on. Also, thank for the critique on my variable name(s)... I am going to re-name a few for the sake of better clarity. I owe you one! Thanks!

[jQuery] Re: Shared variables, events, and namespaces...

2007-12-13 Thread Micky Hulse
Hmmm, would it be standard procedure to put $(window).load() within $ (document).ready()? Also, anyone know of any basic class examples for jQuery? Thanks! :) Cheers, Micky On Dec 13, 12:14 am, Micky Hulse [EMAIL PROTECTED] wrote: Just wondering what would be the best way to handle shared

[jQuery] Re: Shared variables, events, and namespaces...

2007-12-13 Thread Erik Beeson
If you're just looking to keep from polluting the global namespace, you can wrap all of your code in a closure. Lots of info here: http://www.google.com/search?q=javascript+closures For example (untested): (function() { var ele = '#foo'; $(document).ready(function() { $(ele). // ...

[jQuery] Re: Shared variables, events, and namespaces...

2007-12-13 Thread Micky Hulse
Erik, OMG, thanks!!! That is exactly what I was looking for... Also, thanks for the extra tips, that makes perfect sense! Woot! jQuery rocks! Much appreciated. Have a great day/night. ;) Cheers, Micky On Dec 13, 7:47 pm, Erik Beeson [EMAIL PROTECTED] wrote: If you're just looking to keep

[jQuery] Re: Shared variables, events, and namespaces...

2007-12-13 Thread Klaus Hartl
On 14 Dez., 04:47, Erik Beeson [EMAIL PROTECTED] wrote: Then ele will just be available for the scope of your closure. Also, if you really are doing something like your example, you might as well cache the jQuery object instead of the selector to save having to look it up twice. A good

[jQuery] Re: Shared variables, events, and namespaces...

2007-12-13 Thread Klaus Hartl
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 () {