任何人都可以幫助我將JavaScript轉換爲jQuery嗎? JavaScript代碼是:JavaScript to jQuery(函數添加行到表)
function addRow()
{
var table = document.getElementById("table2");
var numOfRows = table.rows.length;
var numOfCols = table.rows[numOfRows-1].cells.length;
var newRow = table.insertRow(numOfRows);
for (var j = 0; j < numOfCols; j++) {
newCell = newRow.insertCell(j);
newCell.innerHTML = "add";
}
}
你爲什麼要把它轉換成jQuery? – Cerbrus
重複? http://stackoverflow.com/questions/171027/add-table-row-in-jquery – chris
因爲javascript代碼應該使用jquery框架來完成... – apolo90