jquery表数据

时间:2012-06-28 21:47:02

标签: jquery jquery-plugins datatables

我有下表

<thead>

<tr>

<th>Account ID</th>

<th>Code</th>

<th>Date Created</th>

<th>Date Expires</th>

<th>Balance</th>

<th>Approve</th>

<th>Deny</th>

</tr>

</thead>

<tbody>

<tr class="test">

<td class="giftcardaccount_id"><span>35083</span>

</td>

<td class="code"><span>xxxxxxxxx</span>

</td>

<td><span>2012-06-28</span>

</td>

<td><span>2012-06-28</span>

</td>

<td><span>9.0000</span>

</td>

<td><Button id="approval_0" type="submit" class="save-button btn success floatRight" ><span>Approve</span> </button>

</td>

<td><Button id="deny_0" type="submit" class="save-button btn danger floatRight" ><span>Deny</span> </button>

</td>

</tr>

<tr class="test">

<td class="giftcardaccount_id"><span>35084</span>

</td>

<td class="code"><span>xxxxxxxx</span>

</td>

<td><span>2012-06-28</span>

</td>

<td><span>2012-06-28</span>

</td>

<td><span>9.0000</span>

</td>

<td><Button id="approval_1" type="submit" class="save-button btn success floatRight" ><span>Approve</span> </button>

</td>

<td><Button id="deny_1" type="submit" class="save-button btn danger floatRight" ><span>Deny</span> </button>

</td>

</tr>

</tbody>

我想要做的是,如果有人点击了已批准的内容,我想获取所有行数据,以及点击已批准按钮的信息。与拒绝按钮相同。我怎么用jquery做到这一点。

感谢

**EDIT**
did this but not sure how to get the button that was clicked. I can get the data by this, but I dont know if the deny was clicked or submit was?

$('。test')。click(function(){

    var id = $(this).children('.giftcardaccount_id').text();


});

1 个答案:

答案 0 :(得分:1)

$('.test').click(function() {
    var id = $(this).find('.giftcardaccount_id:first > span').text();
});