I want to trigger a function when the page is loaded. There are many ways to do this.
However, when I add $('#button').click
in front of my function, then the getType
function is not recognized. For example:
$('#button').click(function getType(id) {
//...some code
});
error: getType is not defined
What am I doing wrong?
Just to clarify, in this case I cannot use an anonymous function. Also, it does not matter to me whether I use $(document).ready
or $(window).bind("load", function()
, but using these I still get the “getType is not defined” error.