Push a multidimensional array in Jquery

你说的曾经没有我的故事 提交于 2019-12-06 04:42:59

问题


I have an array set to "values", and within the array is an multidimensional array called items.

values = {
         full_name: fullname,
         items: [{'item-id': '001', 'item-special': 'nothing'}, {'item-id': '031', 'item-special': 'Make it blue'}],
         address_full: address
         };

How would I push more items into the array?

{'item-id': '055', 'item-special': 'Extra large'}

回答1:


Something like:

values.items.push({'item-id': '055', 'item-special': 'Extra large'});

should work :)



来源:https://stackoverflow.com/questions/8365100/push-a-multidimensional-array-in-jquery

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