使用jQuery“each”函数创建多个数组

时间:2021-12-25 20:36:57

I'm trying to make this:

我想说的是:

myArray = [
  [value1,value2,value3],
  [value1,value2,value3],
  [value1,value2,value3]
];

Using the function each() from jQuery, but I'm stuck even though seeing examples on the web :/ Help.

使用jQuery中的each()函数,但是即使在web上看到示例:/ Help,我还是被卡住了。

$('myRepeatingTag').each(function(){

  //I want to increment myArray[] here with many new values/subvalues

});

1 个解决方案

#1


0  

The answer here, as a friend said above, is to use

正如一位朋友在上面所说,答案是使用

myArray.push([new_value1, value2, value3])

to store new arrays inside the main array.

在主数组中存储新数组。

#1


0  

The answer here, as a friend said above, is to use

正如一位朋友在上面所说,答案是使用

myArray.push([new_value1, value2, value3])

to store new arrays inside the main array.

在主数组中存储新数组。