I created a function like this:
text: function () {
document.getElementById("id").innerText = "Hello";
}
I tried to call this function from another function like this and it doesn't work:
anotherFunction: function () {
this.text();
}
The error I get:
Unhandled exception at line 89, column 21 in ms-appx://b9f1ea0e-9eeb-41e4-a788-92c282715e21/pages/game/game.js
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'text45'
Note: text45 is my function name.
What do I do wrong?
I solved it. There is no way (From what I know) to call a function that is not in the function itself. When I write the function like a regular function in the function itself it worked. Example for what I found:
anotherFunction: function () {
function textchange() {
document.getElementById("id").innerText = "Hello";
}
text();
}
User contributions licensed under CC BY-SA 3.0