構造が似ている HTML テーブルがいくつかあります。どちらも次のようになります。
<table cellspacing="1" cellpadding="7" summary="Procedure Tabulate: Table 1" frame="box" rules="groups" class="table table-bordered table-hover highchart-table">
<thead>
<tr>
<th scope="col" rowspan="2" class="c m Header"> </th>
<th scope="col" class="c Header">3</th>
</tr>
<tr>
<th scope="col" class="c Header">CA R</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row" class="l t RowHeader">Fours</th>
<td class="r b Data">10268.64</td>
</tr>
<tr>
<th scope="row" class="l t RowHeader">Hifi</th>
<td class="r b Data">11267.82</td>
</tr>
<tr>
<th scope="row" class="l t RowHeader">Magneto</th>
<td class="r b Data">11575.91</td>
</tr>
<tr class="blue-bg">
<th scope="row" class="l t RowHeader">Total</th>
<td class="r b Data">33112.36</td>
</tr>
</tbody>
</table>
highchart-table のクラスを使用してすべてのテーブルを実行し、CA R (thead の最後の行の最後のセル) を取得し、最後の「合計行」とは別に、tbody 内に th と td を含む連想配列を作成したいと思います ( ex : フォー => 10268.61、ハイファイ => 11575.91、マグニートー => 11575.91 )。
私の最終的な目標は、次のような配列を作成することです。
hcArr[0]['ind'] = 'CA R';
hcArr[0]['Fours'] = 10268.61;
hcArr[0]['Hifi'] = 11575.91;
hcArr[0]['Magneto'] = 11575.91;
そしてhcArr[1]
、クラスが の次のテーブルの内容を含むhave highchart-table
.
今のところ、私が持っている唯一のコードは次のとおりです。
$.each( $( '.highchart-table' ), function( key, value ) {
});
現在のループにあるテーブルから行とセルを取得する方法がわかりません。
どんな助けでも大歓迎です。