我是一名編程新手,目前我正在學習JQuery。我有一個問題,如果我在列屬性中有一個按鈕,並且當我單擊該屬性的單元格中的按鈕時,我想查找該單元格的唯一標識的值是多少,例如,如果我的屬性名稱被批准值我通過按鈕單擊在「是」和「否」之間切換,我想要在JQuery中獲取唯一的id say name屬性的值,以便我可以使用AJAX調用更新批准的值。在jquery中查找單元格的行
<table>
<th>S.no</th>
<th>Name</th>
<th>Submitted by</th>
<th>Approved</th>
<tr>
<td>1.</td>
<td>XYZ</td>
<td>21-3-04</td>
<td>NO <input type = "button" onclick = "toggle()" value = "click"/></td></tr>
.
.
.
</table>
<script>
function toggle(){
//I want to fetch the value of the Name attribute for the row in which my button was clicked. and later I want to call an ajax call to a url that will consist of Update query.
}
</script>
請給我們展示一些代碼 – jantimon 2013-05-14 09:58:44