Excel VBA 質問スレ Part70at TECH
Excel VBA 質問スレ Part70 - 暇つぶし2ch245:デフォルトの名無しさん
21/04/15 06:20:29.14 5JoH8OD60.net
>>240
jQuery なら、2重ループで、
<h2 id="id-1">ヘッダ</h2>
<table><tbody>
<tr><th>項目1</th><th>項目2</th></tr>
<tr><td>要素1</td><td>要素2</td></tr>
</tbody></table>
<table><tbody>
<tr><th>項目3</th><th>項目4</th></tr>
<tr><td>要素3</td><td>要素4</td></tr>
</tbody></table>
$( function ( ) {
let table = $( '#id-1' ).next( ); //次の兄弟要素
// table > tbody > tr を、1行ずつ処理する
$( table ).children( ).children( ).each( function ( index, row ) {
// 1列ずつ処理する
$( row ).children( ).each( function ( index_2, col ) {
console.log( `${ index }行 ${ index_2 }列`, col.textContent );
} );
} );
} );
出力
0行 0列 項目1
0行 1列 項目2
1行 0列 要素1
1行 1列 要素2


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch