I am using jquery to bind an event to a few buttons…
$(".numField").bind("click", stageButtonClick());
In the function stageButtonClick(), I want to get the object of the calling button, but I cannot use $(this) inside the stageButtonClick function, it doesn’t return anything for me.
Also, please don’t suggest the inline function usage
$(".numField").bind("click", function() {...})
I would like to learn how to do it this way.
Your problem is here:
Don’t use parenthesis when assigning a named function because it will call the function and assign the result instead.
This works:
Demo