如何在HTML中將元素的id屬性添加爲以上在javascript中聲明的變量。將id屬性的值設置爲html中的變量
jQuery的
var table_row = $('table').find('tr#'+pid);
var name = table_row.find('td:nth-child(1)').html();
table_row.find('td:nth-child(6)').html('<button type="button" id="what to write here" class ="save_db")>save</button> ');
我想設置id作爲名稱。
感謝
無法找到你。請解釋。 –
無法找到你。請解釋。 – Tuhin
(根據我的理解)他想通過使用javascript varibale動態設置id。請在他的代碼片段中查看「在這裏寫什麼」文本。 –