On 14/03/07, Tom Holder <[EMAIL PROTECTED]> wrote: > Bit of a simple question this I'm sure but how do I scope a variable to a > plugin I'm creating and not expose it beyond my plugin? I do want the > variable to be accessible to all the methods in my plugin though. > > Thanks > Tom
You could write your plugin like this: (function($) { var myvar = "Element number: "; $.fn.myplugin = function() { return this.each( function(i) { alert(myvar + i); }); } })(jQuery); alert(myvar); // undefined _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/