Reputation: 267
I have the following code: http://jsfiddle.net/LvdcU/3/
I don't understand why I keep getting the following error:
Uncaught ReferenceError: updatetotalorderCals is not defined
I'm sure this has everything to do with my limited js knowledge.
UPDATE:
So the original example error has been resolved, but when applying it to my real-world code, the error returns. I've update jsFiddle with all of the applicable code: http://jsfiddle.net/LvdcU/8/, (probably more than necessary this time) in hopes of getting this working. Thanks!
Upvotes: 0
Views: 160
Reputation: 78710
It's a scope issue. You have the fiddle set to onDomReady
. If you view the source of the page created by the fiddle, you will see this:
var VanillaRunOnDomReady = function() {
function updatetotalorderCals() {
alert("It worked!");
}
}
Because your function is being placed within another function, it is not accessible outside of that function. Change it to no wrap (head)
and you will see that it works.
Upvotes: 0