I was planning on creating several widgets using JQuery UI, and use them polymorphically.
So, say I have two widgets called widget_1 and widget_2, both of which define a "public" method called testMethod(). I would like to blindly take either object and call the testMethod. Something like:
widget.testMethod()
However, JQuery seems to require that I know which object I have since the syntax for calling a method uses the form:
$("#widget_1").widget_1("testMethod");
and
$("#widget_2").widget_2("testMethod");
Are there any other options I have to be able to use widgets polymorphically?
Thanks.