I am looping a object using $.each function, but I'm getting undified values.
What is wrong with my code?
var mainPageCircle = {
circles: {
c1: {
color: '#730000',
text: 'Content'
},
c2: {
color: '#004f74',
text: 'Consulting'
},
c3: {
color: '#146c00',
text: 'Commerce'
}
},
radious: 100,
stroke: 10,
strokeColor: '#fff',
opacity: 0.7
}
$.each(mainPageCircle, function(key, value) {
var circles = value.circles,
radious = value.radious;
$.each(circles, function(index, c) {
console.log(index, c); // i am getting error; i need index should be 0,1,2 and c should be : c1,c2,c3 values
})
})
mainCrProp!=mainPageCircle- or is that just a transcription mistake?circleshave a value when the error occurs? Have you tried using a browser debugging tools to place a breakpoint in the each loop investigating the objects? (F12 default key in most browsers, for Firefox get Firebug), is it the outer or inner each loop causing the problem? Have you tried running it without the inner loop?