テーブルをループして一意の値を選択し、別のテーブルにこれらの一意の値を設定するJqueryコードがあります。私はChromeでデバッガを実行するとJqueryテーブル行にデータ配列を追加する
「の項目が定義されていない」、var items = $.unique(items);
は明らかに2を持つ配列を返します -
var items = [], options = [];
//Iterate all td's in first column
$('#PartsTable tr td:nth-child(1)').each(function() {
//add item to array
items.push($(this).text());
});
//restrict array to unique fleet numbers
var items = $.unique(items);
});
//iterate unique array and build array of select options
// ERROR HERE - 'ITEMS IS UNDEFINED'
$.each(items, function(i, item) {
options.push('<tr><td align="left" valign="top">' + item + '</td><td class="delete" align="center" style="background-color: transparent;"><i class="fa fa-times text-red cur-pon"></i></td></tr>');
});
//finally append the items from the array
$('#OrderSummaryTbody').append(options.join());
次のように私のコードですその中の値。
誰もがこれにどのような光を当てることができますか?ありがとう!
項目が既に宣言されているので、「var」を削除してください。 –