2016-10-14 8 views
0

私はこれを実行していますが、私はコンソールに問題タイトルのエラーを与え続けます。基本的に私はリンクからhref値を読んでいると私は<ul>

HTML

<div id="link"><ul></ul></div> 

のjQueryに

var $thirdColumnCells = $hiddenContentB.find('table.wikitable tr').find('td:nth-child(3) a').attr("href"); 

$thirdColumnCells.each(function(idx, cell) { 
    var valB = $(cell).text().match(/\d+/)[0]; 
    valuesB.push($(cell).html()); 
    $('#link').append('<li>'+ valB + '</li>'); 
}); 
+0

は '$ thirdColumnCells'が文字列である.... –

答えて

1

jQueryの.attr()返す文字列を、それを押しています。何をやっている要素

を保持しているオブジェクトと配列、通常の配列のようなオブジェクトの上に

jQueryの.each()繰り返し処理は

var $thirdColumnCells = $(element).attr("href"); 

$thirdColumnCells.each(... // <- that's a string !!! 
関連する問題