I assume the two functions are different and what you wrote was just an example.
I think it's saying that ternary operators should only be used when setting a variable - not as a shortcut to performing different processing. For example (and I haven't tried this - I'm just guessing) the following processing would be valid:
var a = (name === '') ? "Name not set" : "Name set";
For your example, you could do the following:
var fn = (name !== "") ?
function() { // do one thing } :
function() { // do something else };
$("#id").click(fn);
or even:
$("#id").click( (name !== "") ?
function() { // do one thing } :
function() { // do something else } );
Or, just keep it simple (and more readable) by doing the following:
if (name !== ) {
$("#id").click(function() { // do one thing } );
} else {
$("#id").click(function() { // do something else } );
}
Jamie