Hello all,
Im new to javascript and i cant figure out what im doing wrong here.
I made javascript where you can put products to a table. It makes a row with product, price and delete.
This is working but, my delete button or my delete function isnt working.
Table html code:
<table id=”schema”>
<thead>
<tr>
<td id=”product-head”> Product </td>
<td id=”price-head”> Prijs </td>
<td id=”delete-head”> Verwijder </td>
</tr>
</thead>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
<tbody id=”product-list”></tbody>
</table>
Here the delete function:
function deleteRow(event) {
document.getElementById(“product-list”).removeChild(event.currentTarget.parentElement);
}
Console error:
NotFoundError: Node was not found
…ument.getElementById(“product-list”).removeChild(event.currentTarget.parentEleme…
I just dont understand what im doing wrong here.
Hope someone can explain this to me!