ボタンが選択されている場合、行のテーブルデータを取得する際に問題が発生しています。私は2つのボタンを承認し、拒否し、どのボタンのユーザーがクリックしたかに基づいて、クエリを使用してデータを取得したい。行番号を取得し、行データ以外のものを取得できます。私はIDとテスターを取得する必要があります。ここ その行のボタンをクリックしてjqueryを使用して行データを取得します
は、私がここに<table id="mytable" width="100%">
<thead>
<tr>
<th>ID</th>
<th>Tester</th>
<th>Date</th>
<th>Approve</th>
<th>Deny</th>
</tr>
</thead>
<tbody>
<tr class="test">
<td class="ids">11565 </td>
<td class="tester">james</td>
<td>2012-07-02 </td>
<td><Button id="Approved" type="submit" >Approved</button>
</td>
<td><Button id="deny_0" type="submit" >Denied</button>
</td>
</tr>
</tbody>
</table>
はTRとTD数を得るために、私はJavaScriptで持っているものですが、私は私が必要なものを得るためにそれを使用する方法がわからないです
$(document).ready(function() {
/*$('#cardsData .giftcardaccount_id').each(function(){
alert($(this).html());
}); */
$('td').click(function(){
var col = $(this).parent().children().index($(this));
var row = $(this).parent().parent().children().index($(this).parent());
alert('Row: ' + row + ', Column: ' + col);
// alert($tds.eq(0).text());
console.log($("tr:eq(1)"));
// $("td:eq(0)", this).text(),
});
});