我正在獲取屬性值。我需要設置爲多維數組,但它顯示錯誤。即時發生錯誤?設置jquery多維數組
var myArray = [];
amount=10;
x=1
$(id).closest('td').nextAll().find('input').each(function (n) {
myArray[x]['id'] = $(this).attr('data-id');
myArray[x]['year'] = $(this).attr('data-year');
myArray[x]['month'] = $(this).attr('data-month');
myArray[x]['amount'] = amount;
x++;
});
console.log(myArray);
的[創建通過它二維數組和循環可能的複製在jquery](http://stackoverflow.com/questions/26140640/create-two-dimensional-array-and-loop-through-it-in-jquery) –