Recently, I’ve reworked a javascript tool that I’m working on to be a little more OO than it previously was. In doing this, some of my code is no longer working. I think it has to do with the function and/or members visibility, but I’m not sure.
var buildDiv = new function (obj){
…
var price = document.createElement(‘p’);
price.setAttribute(“id”, getNextPriceId());
price.style.margin = “20px 0px 0px 0px”;
price.style.padding = “0px 0px 0px 0px”;
price.style.fontSize = “12px”;
price.style.fontFamily = “Myraid Pro, Arial”;
price.style.fontWeight = “bold”;
price.innerHTML = obj.price;
priceDiv.appendChild(price);
}
The problem is that when I try to assign text into the innerHTML it doesn’t seem to take. While debugging, I can see that obj.price has information in it, but after stepping over the ‘price.innerHTML = obj.price’ line, it just assigned ‘undefined’ into the innerHTML.
buildDiv is a member of the class, ‘MyTool’. I know this is probably something easy that I’m just not seeing.
Thanks in advance!