I have a js file with code like this:
var myAnonFun = function (param1) {
function createHTML(){
.....
sHTML += "<select id=param1 onchange='makeCalculations(this)' >";
}
var vText = document.getElementById("results");
vText.innerHTML = sHTML;
function makeCalculations(){
}
}
Then, in a HTML file I have something like this:
var createAnonFun = myAnonFun (param1);
The code inside the js file will work as expected. However, whenever a value is chnaged in the select html object created inside the js file, I will get an error stating that there is not makeCalculations function.
As far as I understand, the problem is that the select object is trying to reach a function from the global scope, and of course there isnt one there.
So my question is: how can I target the select object to the makeCalculations function inside the myAnonFun var?
thank you in advance!