How to make object assign its own method to a DOM node?
Hi.
I'm having troubles to come up with a way to assign an object's method to a DOM-node created by the object without hardcoding object's name.
For example:
Code:
function currancySwitcher(){
this.currancy = ['euro','usd','sek']
var a = document.createElement('a');
a.title = this.currancy[0]
a.href = '#'+this.currancy[0]
a.onclick = function(){
myObject.setCurrancy(this.title);
Leave a comment: