Thanks Mike, I'm following this tutorial here: http://www.learningjquery.com/2007/10/a-plugin-development-pattern
I have several public functions like this: $.fn.response.redirect.default = function (){//something here}; $.fn.response.redirect.type1 = function (){//something here}; $.fn.response.redirect.type2 = function (){//something here}; I wanted to be able to call the appropriate function depending on a string passed back to me via json Im thinking of doing it like this (based on your example): if($.fn.response.redirect[response.redirect_type] !== undefined) $.fn.response.redirect[response.redirect_type](); else $.fn.response.redirect.default(); Do you think it would work? Thanks again for your help Raine On Jan 2, 3:34 am, "Michael Geary" <m...@mg.to> wrote: > I don't know about the $.fn.myplugin part - that's not how you would > typically call a plugin function in the first place. > > But in general, given any object 'foo' and any property 'bar', you can > reference the 'bar' property in either of two ways: > > foo.bar > > Or: > > foo['bar'] > > If 'bar' is a method, you can call it with: > > foo.bar(...); > > Or: > > foo['bar'](...); > > Either one means exactly the same thing. > > One common use for this is with show and hide methods. Instead of coding: > > if( doShow ) > $('#foo').show(); > else > $('#foo').hide(); > > You can code: > > $('#foo')[ doShow ? 'show' : 'hide' ](); > > -Mike > > > From:yellow1912 > > > Something like this > > var func = 'myFunc'; > > > Can I call the function like this for example: > > > $.fn.myplugin.(func)(); > > > (I'm using this in a plugin I'm working on) > > > Thank you very much