我有以下HTML:幫助使用jQuery選擇正確的元素
<div class="result-row odd">
<div class="domain-name">first-domain.com</div>
<div class="domain-functions">
<a onclick="deleteDomain(1)" href="javascript:void(0);">
<img height="24" width="24" alt="48x_delete" src="images/48x_delete.png">
</a>
<a onclick="editDomain(1)" href="javascript:void(0);">
<img height="24" width="24" alt="48x_delete" src="images/48x_editwebpage.png">
</a>
</div>
</div>
<div class="result-row even">
<div class="domain-name">second-domain.com</div>
<div class="domain-functions">
<a onclick="deleteDomain(2)" href="javascript:void(0);">
<img height="24" width="24" alt="48x_delete" src="images/48x_delete.png">
</a>
<a onclick="editDomain(2)" href="javascript:void(0);">
<img height="24" width="24" alt="48x_delete" src="images/48x_editwebpage.png">
</a>
</div>
</div>
我想點擊編輯按鈕時用的輸入字段來代替first-domain.com ...
我到目前爲止:
function editDomain() {
$('.domain-name').html('<input class="inline" type="text"/><input class="inline" type="button" value="save"/>');
}
這改變了我所有的標題 - 什麼是最好的方式來取代只有正確的標題?
'這改變了我所有的標題'是什麼意思? – 2010-09-20 16:39:26