Reputation: 3
This seems really simple but I can't get it working...
function myfunction(id)
{
alert("ID: " + id);
}
There is a fiddle here http://jsfiddle.net/66ALW/
The error I get in Firebug is ReferenceError: myfunction is not defined http://fiddle.jshell.net/_display/ (1) Line 1
Upvotes: 0
Views: 125
Reputation: 1251
You are defining myfunction
in the onLoad
event, so it isn't being populated in the global namespace. Thus, function appears to not exist. There are two solutions.
window.myfunction = myfunction;
Upvotes: 0
Reputation: 345
You need set "No wrap in head" in jsfiddle to solve your problem: http://jsfiddle.net/66ALW/2/
function myfunction()
{
alert("Reached");
}
code is ok.
Upvotes: 1