again very basic question i know but i dont know why my code isnt working im buliding an electron app from scratch and i learning these skills from internet only so i have only you guys to ask questions :p
document.getElementById("arrBtn").addEventListener("click", async function (event) {
getData = await window.api.GetRow()
let bigArr = document.getElementById("arr").innerHTML = getData;
});
the above code giving me a stringyfied array of objects in my html on click event but when im trying to convert those object into row in a table nothing happening on click codes are below
document.getElementById("arrBtn").addEventListener("click", async function (event) {
// const myArr = async () => {
getData = await window.api.GetRow()
let bigArr = document.getElementById("arr").innerHTML = getData;
function buildTable(data){
let table = document.getElementById("myTable");
for (let i = 0; i < data.length; i++) {
let line = `<tr>
<td>${data[i].name}</td>
<td>${data[i].property}</td>
</tr>`
table.innerHTML += line
}
}
buildTable(getData);
});
i have already created table and table head in html i just want to add rows in my existing table below is my html
<table class="responsive-table striped">
<thead>
<tr>
<th>Name</th>
<th>Property</th>
</tr>
</thead>
<tbody id="myTable">
<tr>
<td>Alvin</td>
<td>Eclair</td>
</tr>
</tbody>
</table>