0

これで私を助けてください。

for をループする代わりに、最初の td または 2 番目の id を取得するようなものはありますか?

例 :

"<tr class='test_point' id="+fileName+"><td><img src='"+ROOT_PATH+"/assets/diamond.png' /><td class='test_point_name' id="+test_point_id+">"+test_point

+"</td></tr>"

ここでIDでtrを取得します

$(#fileName).each(function( index ){
  console.log( index + ": " + $(this).text() );
  //console.log("id_value: "+$(this).attr('id'));
  console.log("test_value: "+ $(this).find('td').attr('id'))
}   
4

3 に答える 3

1

indexidで項目を取得するには、これを使用します。

デモ

$('#fileName').find('td')[0].id;

where[0]は最初、[1]2 番目などを意味します。

于 2013-06-14T18:05:11.287 に答える