我在创建后找到了这段代码
<table> ... content ...
</ tables>
...我需要循环“FOR”之外的“j”的累积值...
var dt = $(".table thead th").length;
for (var i = 0; i < dt; ++i) {
(function (j) {
var dt = $(".table thead th").length;
$(".table thead").each(function () {
var $ths = $(this).find('th');
if ($ths.length != 0 && $ths.eq(j).text() != "Estado" && $ths.eq(j).text() != "ESTADO" && $ths.eq(j).text() != "Acciones" && $ths.eq(j).text() != "ACCIONES") {
j = j + ","; // I need this value, the value to be displayed is something like this: 0,1,2,3 ...
alert(j);
}
});
return j;
})(i);
}
/* I need the value of "j" here, but this does not work */
var variable = j;
alert(variable);