I started learning OOP in JavaScript at school and I have to do my homework in OOP. It is a shopping list, one fills in a product and price and that is put into an array, the array its contents are put in a table in HTML. The list also has got delete buttons for every product, I have thought about using this in JavaScript, as I am working in OOP, but I am sceptic because of the scope.The idea is that one clicks verwijder on the webpage (EDIT: in the corresponding row) and the table row is gone. I have thought about using this but also about dynamically updating the table after removing the selected row from the array.Who can advise me about what to do and how to do that correctly? I have uploaded my JavaScript here: http://jsfiddle.net/hNAZ9/Mainly, it is about this piece of code:    function ShoppingList(){    this.items = [];    this.setItem = function(product, price){        var item = new Item(product, price);        this.items.push(item);    };    this.render = function(){        var placeHolder = document.getElementById(shoppingList);        placeHolder.innerHTML = ;        for(var i = 0; i <this.items.length; i++){            var tr = document.createElement(tr);            tr.id = i;            var tdProduct = document.createElement(td);            tdProduct.innerHTML = this.items[i].product;            tr.appendChild(tdProduct);            var tdPrice = document.createElement(td);            tdPrice.innerHTML = this.items[i].price;            tr.appendChild(tdPrice);            var tdDel = document.createElement(td);            tdDel.innerHTML = Verwijder;            tdDel.addEventListener(click, delItem, false);            tr.appendChild(tdDel);            placeHolder.appendChild(tr);        }    };}    function delItem(e){    e.preventDefault();    // What do I have to do here?}
Deleting a table row in JavaScript with OOP
javascript;object oriented;html5