I set this variable at the top of my page setVars = {"n":"2","m":"1","degree":"3","p":"2"}
I want to iterate over each of the elements in setVars but jquery’s each() function isn’t working.
Here’s what I have –
$(setVars).each(function(key, value) {
elementId = '#' + key+ '-wrapper';
}
But key is set to 0 here on the first iteration and value is set to the full setVars object here for some reason. It doesn’t make it to a second iteration, it breaks when I step through it and try to go to the second iteration.
It should be like that I belive according to this http://api.jquery.com/jQuery.each/
setVars is not a collection of DOM elements, it is an object