[Originally post on jQuery-en]
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---