In your example, it’s a little difficult to understand exactly what you are trying to do, but if you want to use arraysand $.each, you can do this:
var defaults = {
test: 'yes',
types: [
{
minvalue: '100',
maxvalue: '200',
name: 'id1'
},
{
minvalue: '200',
maxvalue: '300',
name: 'id2'
},
{
minvalue: '300',
maxvalue: '400',
name: 'id3'
}
]
};
$.each(defaults.types, function(index, value) {
alert(value.name + ': ' + value.minvalue);
});
http://jsfiddle.net/niklasvh/kFjVN/
source
share