Skip to content Skip to sidebar Skip to footer

Why Does Jsfiddle Throw Error That Function Is Not Defined?

The example I was testing is very simple: just one button, and when button is clicked then a function will be called. However, I'm getting: error ReferenceError: AddNewData is not

Solution 1:

It's because by default jsfiddle uses onLoad JS definition for your code.

That's it - it's wrapped in an anonymous function so all symbols (variables, functions, etc) are scoped within.

Change it to No wrap - in <head>

http://jsfiddle.net/62Ls6x9n/160/

Post a Comment for "Why Does Jsfiddle Throw Error That Function Is Not Defined?"