我有我的表有问题,我需要把几个变量在我的表,这是我的错误问题JS表
TypeError: tabproduit[i] is undefined
tabproduit[i][0] = $(this).text();
,这是我的代码
var tabproduit = new Array(new Array());
var i = 0 ;
$(".eachnom").each(function(index) {
tabproduit[i][0] = $(this).text();
i++;
});
但是,当我不把i++;
我没有错误,但我只有1变量在我的表;如何把这个i++;
?
在此先感谢
使用'index'而不是'i'.Its也在每个函数调用中递增。像这样'tabproduit [index] [0]' – prasanth
问题是你还没有显示你的html部分 – Mahi