Intento insertar en un tablecell un botón con un evento onclick con dos argumentos. Pero aparece el error "SyntaxError: final inesperado de la entrada".
No puedo encontrar el error. ¿Tienes alguna sugerencia?
¡Muchos gracias!
async function generate_table() { var tbl = document.getElementById("table"); var tblBody = document.createElement("tbody"); let data = await axios.get("https://www.semmelsemrau.de/getAllEntries"); // creating all cells for (var i = 0; i < data.data.result.length; i++) { // creates a table row let dataRow = JSON.stringify(data.data.result[i]); console.log(dataRow); var row = document.createElement("tr"); let cell1 = document.createElement("td"); var cell1Text = document.createTextNode(data.data.result[i].ID); cell1.appendChild(cell1Text); let cell2 = document.createElement("td"); var cell2Text = document.createTextNode(data.data.result[i].Geraet); cell2.appendChild(cell2Text); let cell3 = document.createElement("td"); var cell3Text = document.createTextNode(data.data.result[i].Number); cell3.appendChild(cell3Text); let cell4 = document.createElement("td"); var cell4Text = document.createTextNode(data.data.result[i].Standort); cell4.appendChild(cell4Text); let cell5 = document.createElement("td"); var cell5Text = document.createTextNode(data.data.result[i].Ausleihe); cell5.appendChild(cell5Text); let cell6 = document.createElement("td"); cell6.className = "imageContainer"; cell6.innerHTML = `<img class="image" rowid=${data.data.result[i].ID} src=https://www.semmelsemrau.de/${data.data.result[i].Foto}></img>`; let cell7 = document.createElement("td"); cell7.className = "edit"; cell7.innerHTML = `<button onclick="editRow(${ (data.data.result[i].ID, dataRow) })"><i class="fa fa-edit" aria-hidden="true"></i></button>`; row.appendChild(cell1); row.appendChild(cell2); row.appendChild(cell3); row.appendChild(cell4); row.appendChild(cell5); row.appendChild(cell6); row.appendChild(cell7); // add the row to the end of the table body tblBody.appendChild(row); } // put the <tbody> in the <table> tbl.insertAdjacentElement("beforeend", tblBody); // sets the border attribute of tbl to 2; tbl.setAttribute("border", "2"); }