The short answer is, yes, you're doing the wrong thing to try to
namespace plugins. It's not officially supported. If you really want
to, I wrote a small plugin that simulates namespaces by copying
methods in and out of the jQuery object; it was discussed here:
http://www.nabble.com/Re%3A-passing-this-p13540912s27240.html

Danny

On Jan 9, 12:29 pm, Zoram <[EMAIL PROTECTED]> wrote:
> I am working on a plugin and was trying to figure out what was
> happening to break my code..
>
> I have in my plugin functions similar to the following:
>
> $.fn.pluginName = function() {}
>
> $.fn.pluginName.oneThing = function () {
>    ...
>
> }
>
> $.fn.pluginName.anotherThing = function () {
>    ...
>
> }
>
> I try to call it like so:
>
> $('#idOfElement').pluginName.oneThing();
>
> The problem is that the this.each() is 'not defined' when I use it in
> the oneThing or anotherThing methods. If I do the methods as:
> $.fn.oneThing and $.fn.anotherThing it works fine... but not when they
> are under the pluginName. Why would this happen and is there a way to
> fix it? or am i trying to do the wrong thing tonamespacethe methods?
>
> Thanks in advance.

Reply via email to