I've seen this done, but I can't find an example anymore. What I'd like is to switch a jQuery action... the code below is just an example, it is not the code I am using, I'm just trying to remember how this works.
var action = (getURL) ? "attr('href')" : "html()";
alert( "The result is" + $('#myLink')[action] );
I also tried
var action = (getURL) ? ".attr('href')" : ".html()";
alert( "The result is" + $('#myLink')[action] );
sorry my memory stinks and I couldn't find an example of this in the jQuery docs either. I'm not even sure if those are called "actions".