0
我有一個CRUD從數據庫加載表,我希望表格行可編輯通過轉換表單元格輸入字段保存單元格文本作爲輸入值。我正在使用jQuery。 到目前爲止,我可以在標籤內添加輸入字段。但是來自所有單元的數據成爲每個輸入的值,而不是變成其各自輸入字段的值。這裏是我的代碼更改表格單元格的輸入值與jquery
$("#parEdit").click(function(){
$(this).text("Update");
$(this).closest('tr').children().wrapInner('<input type="text" value = ' + $('td').text() + '></input>');
})
表 ID |名稱|位置|商標|編輯|
1 |艾哈邁德| 6th | 525 |編輯按鈕|
按下編輯按鈕後的輸出是這樣的
ID |名稱|位置|商標|編輯|
1Ahmad6th525 | 1Ahmad6th525 | 1Ahmad6th525 | 1Ahmad6th525 |更新按鈕|
您遺漏了點擊函數的結束標記。感謝您的幫助 – rakibulmuhajir
糟糕!非常感謝 –