You are trying to assign the return value of changeColor()
to box.click()
instead of the function itself. Wrapping changeColor()
in a function as follows sets the box.click()
to the function
box.click(function(){
changeColor.call(this, "green")
});
See Fiddle