I\'m doing some testing on jQuery.data()
, and I\'m trying to create a local reference to a certain data-key, which I hopefully can change locally and still affect \
I am not going to lie - that code is incredibly confusing. Is there a reason why you need to use all those self-executing functions? It seems (at least to this layperson) that you could code this in a much more straightforward way to achieve your goal.
Anyway I am not sure this is the answer you're looking for, but I just stopped the debugger inside AddError
so I could understand its scope and what was available. So all you need to do to make it return the output you want is this:
http://jsfiddle.net/qN7wF/2/
functions = {
AddError: function() {
console.log(total);
$(container).data('errors').total++;
errors.length++;
},
But given the context... I'm guessing there must be more at play.