If I have an object :
function myClass(id) {
this.em = document.getElementById(id);
this.html = function(data) {
this.em.html = data;
}
}
Now I can :
var em = new MyClass("id");
em.html("NEW HTML HERE");
I need :
em.html = "NEW HTML HERE";
Is It possible?
In HTML5 you could define a
setmethod on thehtmlproperty (seedefineProperty())… but this will only work in the most modern browsers; IE8, Chrome 5, Firefox 4.
See a demo of the above working here; http://jsfiddle.net/sskKc/