We'd love to help with this question over on the jQuery UI list, for the
benefit of everyone there:

http://groups.google.com/group/jquery-ui

Thanks.

- Richard

On Wed, Feb 18, 2009 at 4:31 AM, Aleem B <ale...@gmail.com> wrote:

>
> I created a widget and figured that it can only be called once per element:
>
> $.widget('ui.mywidget', {
>    _init: function() {
>        alert('hello');
>    }
> }
>
> $.widget("ui.mywidget", mywidget);
>
>
> $("#foo").mywidget(); // alerts hello
> $("#foo").mywidget(); // doesn't do anything
>
>
> now I understand this is by design because _init acts like a static
> constructor. however, I want to create a widget to add a panel to #foo
> each time it's called so:
>
> $("#foo").addpanel();
> $("#foo").addpanel();
>
> But that obvioulsy fails.What's the work around or what is a better
> design? I don't want to do:
> $("#foo").addpanel();
> $("#foo").addpanel("add");
> $("#foo").addpanel("add");
>
> because that requires an extra () call followed by ("add"), ("add").
>
>
>
>
>
> -- Aleem
>

Reply via email to