我有一個表像這樣:如何抓住用jQuery的元素沒有辦法通過類,ID來引用它,等
<table>
<thead>
<tr>
<th>Hostname</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>127.0.0.1</td>
<td><a name="delete" onclick="remove_host('127.0.0.1')">Remove</a></td>
</tr>
<tr>
<td>127.0.0.2</td>
<td><a name="delete" onclick="remove_host('127.0.0.2')">Remove</a></td>
</tr>
<tr>
<td>127.0.0.3</td>
<td><a name="delete" onclick="remove_host('127.0.0.3')">Remove</a></td>
</tr>
</tbody>
我想要做的是,當用戶點擊刪除,鏈接被替換爲其中一個加載圖像,以便用戶不能重複點擊鏈接。
如何獲得a
元素,所以我可以用jQuery設置HTML?
在網站的其他部分,我可以附加rel="host-1"
(或類似)的鏈接,所以我可以很容易地引用它來改變HTML。
對於屬性-等於選擇 '引號是強制性** **',參考文獻:[屬性等於選擇器在API](HTTP: //api.jquery.com/attribute-equals-selector/)。 – 2011-05-16 19:35:42
@大衛:謝謝更新 – PeeHaa 2011-05-16 19:38:32