JQuery UI - Using Widgets Polymorphically
I was planning to create multiple widgets using JQuery UI and use them polymorphically.
So, let's say I have two widgets named widget_1 and widget_2, both of which define a "public" method called testMethod (). I would like to blindly take any object and call testMethod. Sort of:
widget.testMethod()
However, JQuery seems to require me to know which object I have, since the method call syntax uses the form:
$("#widget_1").widget_1("testMethod");
and
$("#widget_2").widget_2("testMethod");
Are there any other parameters that I should be using for displaying widgets?
Thanks.
+2
a source to share
1 answer