誰かがテーブルの [ダウンロード] ボタンをクリックしたときに、その特定の行の日付値を関数に渡したいと考えています。現在、最初のテーブル行からの日付値のみを渡すことができます。
これは私が使用しているセレクタです:
$(this).parent().find('#period-start');
常に返されるもの:
[<td id="period-start">5/1/2013</td>]
親、子、検索、および最も近いセレクターの組み合わせを試しましたが、現在の行から日付値を取得するための正しいセレクターに出くわすことができませんでした。ありがとう。
テーブル
<table id="tblStatements" class="table">
<thead>
<tr>
<th>Period Starting</th>
<th>Period Ending</th>
<th>Download</th>
</tr>
</thead>
<tbody>
<tr>
<td id='period-start'>5/1/2013</td>
<td id='period-end'>5/31/2013</td>
<td><button type='submit'>Download</button></td>
</tr>
<tr>
<td id='period-start'>4/1/2013</td>
<td id='period-end'>4/30/2013</td>
<td><button type='submit'>Download</button></td>
</tr>
<tr>
<td id='period-start'>3/1/2013</td>
<td id='period-end'>3/31/2013</td>
<td><button type='submit'>Download</button></td>
</tr>
</tbody>
</table>