I've written a class and this is a snippet taken from it to demonstrate my problem.

```
<!--language:lang-js-->    
var myclass = function () {
    this.addItem = function () {
        //generateDiv and append..
        //generatedeletebtn and append
        btn.onclick = this.deleteItem; 
    }
    this.deleteItem = function () {
        console.log(this);
    }
}

```

Inside the `deleteItem` function, `this` represents the HTML element clicked. Is there a way I can access the myclass object directly?

I've tried changing 
`div.onclick = this.deleteItem` 
to
 `div.onclick = this.deleteItem(this)` which works as far as accessing the object but the parenthesis invoke the function and remove the items as soon as they're added so that's no good.