jquery .each objects

限于喜欢 提交于 2019-12-04 13:04:35

With your example it is a bit difficult to figure what exactly you are trying to do, but if you want to use arrays and $.each, you could do this:

 var defaults = {
            test: 'yes',   //css/classes
     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/

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!