I am currently using jQuery widget jget servers, and I kind of hit in a call to public methods with a parameter.
This is what I did.
//Widget $.widget('ui.MyWidget',{ public_method_without_params: function(){ //do something; } public_method_with_params: function(word){ //do something; } });
I am trying to call public_method from the outside. If it has no parameter, I would do either
(i) $('#some-element').MyWidget("public_method_without_params")
(or)
(ii) $('#some-element').data("MyWidget").public_method_without_params();
Is it possible to call public_method_with_params similar to the above (i)?
Thanks.
source share